#637355 git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
Tanguy Ortolo
Date:
2011-08-10 16:33:04 UTC
Severity:
wishlist
#637355#5
Date:
2011-08-10 16:03:56 UTC
From:
To:
Hello,

git-mergetool ideally uses tools that work with 4 files: BASE, LOCAL,
REMOTE, which are the usual original and two new version of the file,
and MERGED, which is where the tool is supposed to write the result of
the merge.

The problem is that most tools, at least graphical ones, specifically
meld, can only work with three files, as they save the result to the
original file.

git-mergetool currently handles this situation by passing MERGED LOCAL
REMOTE to the tool. This could be fine, but unfortunately MERGE contains
the conflicts, formatted for manual resolution, so it is not really
appropriate as an original file.

I think it would be better to wrap such merge tools by:
1. passing them BASE LOCAL REMOTE;
2. checking whether or not BASE hase been modified:
   * if it has, then copying it to MERGED,
   * if it has not, exiting with return code 1 (merge failed).
This check can be by either saving and comparing the mdate, or perhaps
the SHA-1 hash of the BASE file.

If this sounds good enough, I can dive into git-mergetoo--lib and
implement it. In the meantime, here is an example of a custom merge tool
that wraps meld for that purpose.

Librement,

#637355#10
Date:
2011-08-10 16:14:49 UTC
From:
To:
found 637355 git/1:1.7.6-1
tags 637355 + upstream
forwarded 637355 http://thread.gmane.org/gmane.comp.version-control.git/179072
quit

Tanguy Ortolo wrote:
[...]

Thanks for a clear report.  Let's take this upstream.

#637355#21
Date:
2011-08-10 16:27:59 UTC
From:
To:
Jonathan Nieder, 2011-08-10 11:14 UTC-0500:

Perfect. It appears that I have forgotten to attach my example, so here
it is.

#637355#26
Date:
2011-08-10 16:29:42 UTC
From:
To:
Tanguy Ortolo wrote:

Hm, could you send that to the upstream people (i.e., reply-to-all to
the other subthread)?

Sorry for the fuss.