[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoiding the three-windows merging with Git
From: |
Kévin Le Gouguec |
Subject: |
Re: Avoiding the three-windows merging with Git |
Date: |
Tue, 26 Nov 2019 08:16:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Richard Stallman <address@hidden> writes:
> I don't know how to provoke a conflict intentionally.
> I'd have to ask someone to install a patch that conflicts
> with something I want to install. However, doing that in
> a Git repo where it will be impossible to remove later
> seems like a bad idea.
>
> Can someone help me create a conflict to test handling it?
create-conflict.sh
Description: Text Data
Attached is a silly script to create a conflict on a temporary
repository. The script creates 3 folders in the current directory:
- hacker-repo: the folder where one hacker is working,
- hacker2-repo: the folder where another hacker is working,
- server-hosted-repo: the "central repository" where both hackers
update from and commit to.
The script runs the following operations:
- create the central repository,
- make the first hacker commit a one-line file,
- make the second hacker update this file and commit the changes,
- make the first hacker update the file without updating from the
central repository first.
(Some of these operations could probably have been expressed in terms
of vc commands; apologies for not taking the time to do so.)
>From there one can start emacs -Q to observe the conflict:
$ emacs -Q hacker-repo
C-x v +
That gets me a log buffer from vc saying:
> Running "git pull --stat"...
> From ../server-hosted-repo
> * branch master -> FETCH_HEAD
> Auto-merging README
> CONFLICT (content): Merge conflict in README
> Automatic merge failed; fix conflicts and then commit the result.
And indeed, visiting the README, I see conflict markers, and the
Smerge minor mode enabled (see attached screenshot).
C-h b tells me that C-c ^ E runs smerge-ediff, which spawns Ediff's
3-window merge UI.
vc-update-conflict.png
Description: PNG image