Thread (1 message) 1 message, 1 author, 2016-08-11

Re: [PATCH] diff-format.txt: Combined diff format documentation supplement

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:14:59

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


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help