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

Diftool problems

From
Marcin Zalewski <marcin.zalewski@gmail.com>
Date
Apr 29, 2009, 16:15 UTC
Message-ID
<7c0fdf4f0904290915i56f58981i70e7093e9bf87d8b@mail.gmail.com>
Hi,

When git-difftool calls a diff tool, it uses file names given to it by git-diff. This is a problem because often one of the files to be compared is the same as the file to be merged into. What I mean is that, in the following fragment of the git-difftool--helper file, $1 and $2 (I think) may end up being the same:

launch_merge_tool () {
	# Merged is the filename as it appears in the work tree
	# Local is the contents of a/filename
	# Remote is the contents of b/filename
	# Custom merge tool commands might use $BASE so we provide it
	MERGED="$1"
	LOCAL="$2"
	REMOTE="$3"
	BASE="$1"

Git-mergetool creates a temporary file for merging, but git-difftool does not. Since git-diff tools is not meant for merging anything, it may seem that there is no problem. However, some merge tools (such as ediff) do not like when the merge target is the same as one of the files to be compared. I use the following emacs snippet by Theodore Tso:

http://kerneltrap.org/mailarchive/git/2007/7/2/250505

With that emacs code, ediff refuses to do a diff with the way that difftool is done now. I do not have a patch, but it seems that a simple fix would be to copy the code that creates temporary files from mergetool.

Cheers, Marcin Zalewski

Next: Markus Heidelberg
Message 1 of 6 in “Diftool problems”
  1. Marcin ZalewskiApr 29, 2009
  2. Markus HeidelbergApr 29, 2009
  3. Marcin ZalewskiApr 29, 2009
  4. Markus HeidelbergApr 29, 2009
  5. Marcin ZalewskiApr 29, 2009
  6. David AguilarMay 2, 2009

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.