git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Junio C Hamano
Message 10 of 10 in “Combined diff format documentation”
  1. Jakub NarebskiOct 25, 2006
  2. Junio C HamanoOct 25, 2006
  3. Jakub NarebskiOct 25, 2006
  4. Junio C HamanoOct 25, 2006
  5. Junio C HamanoOct 25, 2006
  6. Jakub NarebskiOct 25, 2006
  7. diff-format.txt: Combined diff format documentation supplementJakub Narebski, Oct 26, 2006
  8. Junio C HamanoOct 26, 2006
  9. Junio C HamanoOct 26, 2006
  10. Junio C HamanoOct 26, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.