diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2014-08-21 09:47:20 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-08-21 12:43:08 -0700 |
commit | 7786cc91bb2edb14db56589b9c59f3ee294ac49b (patch) | |
tree | 48b4ea44beda797d1d2c7887bbee3985e595d996 | |
parent | 32f56600bb6ac6fc57183e79d2c1515dfa56672f (diff) | |
download | git-rr/mergetool-temporary-filename-tweak.tar.gz |
Allow the user to change the temporary file name for mergetoolrr/mergetool-temporary-filename-tweak
Using the original filename suffix for the temporary input files to
the merge tool confuses IDEs like Eclipse. This patch introduces
a configurtion option, mergetool.tmpsuffix, which get appended to
the temporary file name. That way the user can choose to use a
suffix like ".tmp", which does not cause confusion.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Documentation/config.txt | 5 | ||||
-rw-r--r-- | Documentation/git-mergetool.txt | 7 | ||||
-rwxr-xr-x | git-mergetool.sh | 10 |
3 files changed, 18 insertions, 4 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index c08286e968..12f9b962b3 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1766,6 +1766,11 @@ notes.displayRef:: several times. A warning will be issued for refs that do not exist, but a glob that does not match any refs is silently ignored. + +mergetool.tmpsuffix:: + A string to append the names of the temporary files mergetool + creates in the worktree as input to a custom merge tool. The + primary use is to avoid confusion in IDEs during merge. + This setting can be overridden with the `GIT_NOTES_DISPLAY_REF` environment variable, which must be a colon separated list of refs or diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 07137f252b..d8161bef1d 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -87,6 +87,13 @@ Setting the `mergetool.keepBackup` configuration variable to `false` causes `git mergetool` to automatically remove the backup as files are successfully merged. +`git mergetool` may also create other temporary files for the +different versions involved in the merge. By default these files have +the same filename suffix as the file being merged. This may confuse +other tools in use during a long merge operation. The user can set +`mergetool.tmpsuffix` to be used as an extra suffix, which will be +appened to the temporary filename to lessen that problem. + GIT --- Part of the linkgit:git[1] suite diff --git a/git-mergetool.sh b/git-mergetool.sh index 332528ff45..5d6c220d8a 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -214,6 +214,8 @@ checkout_staged_file () { } merge_file () { + tmpsuffix=$(git config mergetool.tmpsuffix || true) + MERGED="$1" f=$(git ls-files -u -- "$MERGED") @@ -229,10 +231,10 @@ merge_file () { fi ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')" - BACKUP="./$MERGED.BACKUP.$ext" - LOCAL="./$MERGED.LOCAL.$ext" - REMOTE="./$MERGED.REMOTE.$ext" - BASE="./$MERGED.BASE.$ext" + BACKUP="./$MERGED.BACKUP.$ext$tmpsuffix" + LOCAL="./$MERGED.LOCAL.$ext$tmpsuffix" + REMOTE="./$MERGED.REMOTE.$ext$tmpsuffix" + BASE="./$MERGED.BASE.$ext$tmpsuffix" base_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==1) print $1;}') local_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==2) print $1;}') |