public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Markus Heidelberg <markus.heidelberg@web•de>
To: Marcin Zalewski <marcin.zalewski@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: Diftool problems
Date: Wed, 29 Apr 2009 21:42:59 +0200	[thread overview]
Message-ID: <200904292142.59471.markus.heidelberg@web.de> (raw)
In-Reply-To: <7c0fdf4f0904290915i56f58981i70e7093e9bf87d8b@mail.gmail.com>

Marcin Zalewski, 29.04.2009:
> 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.

The real fix would be to adjust the ediff snippet for difftool support.

As you said yourself, git-difftool is not meant for merging files, so
there is no reason to open more than 2 files at all.

The built-in difftools 'emerge' and 'ecmerge' still seem to open LOCAL,
REMOTE and MERGED. This should be fixed, so that they don't open MERGED
any more, but I don't have emacs installed, so I shouldn't try it
myself.

Oh, and LOCAL shouldn't be copied to a temporary file in the first
place, because people don't use git-difftool in read-only mode only.

Markus

  reply	other threads:[~2009-04-29 19:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 16:15 Diftool problems Marcin Zalewski
2009-04-29 19:42 ` Markus Heidelberg [this message]
2009-04-29 19:55   ` Marcin Zalewski
2009-04-29 20:48     ` Markus Heidelberg
2009-04-29 21:37       ` Marcin Zalewski
2009-05-02  9:05     ` David Aguilar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200904292142.59471.markus.heidelberg@web.de \
    --to=markus.heidelberg@web$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=marcin.zalewski@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox