Re: [PATCH] diff-format.txt: Combined diff format documentation supplement
- From
Junio C Hamano <junkio@cox.net>
- Date
- Oct 26, 2006, 07:10 UTC
- Message-ID
- <7vvem7r1rl.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <7v1wovsgkf.fsf@assigned-by-dhcp.cox.net>
This script minimally demonstrates a few interesting things an evil merge can do. Run it in a throw-away directory and view the resulting merge with "git-show" with or without the patch I sent out earlier.
One thing that you would notice is that the combined-diff code chooses not to show the original contents of a deleted file. while showing the whole result of a new file. Strictly speaking, this is inconsistent, but an evil merge is rare and what ended up getting removed is not as interesting as what remains as the result.
-- >8 -- #!/bin/sh
test -d .git && {
echo Run me in an empty directory please
exit 1
}git init-db
echo one >file1.txt git add file1.txt git commit -m initial
git branch side
echo two >file2.txt git add file2.txt git commit -m second
git checkout side echo uno >file1.txt git commit -a -m side
git merge "Evil merge" HEAD master rm -f file1.txt echo added by the evil merge >file3.txt echo modified by the evil merge >file2.txt git update-index --add --remove file1.txt file2.txt file3.txt EDITOR=: VISUAL=: git commit --amend