[PATCH] Allow the user to change the temporary file name for mergetool

Subsystems: documentation, the rest

DORMANTno replies

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] Allow the user to change the temporary file name for mergetool

From: Robin Rosenberg <hidden>
Date: 2016-06-15 23:02:17

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 <redacted>
---
 Documentation/git-mergetool.txt |  7 +++++++
 git-mergetool.sh                | 10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e846c2e..a586766 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -89,6 +89,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
+`mergtool.tmpsuffix` to be used as an extra suffix, which will be
+appened to the temporary filenamame to lessen that problem.
+
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 9a046b7..d7cc76c 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;}')
-- 
2.1.0.rc2.6.g39c33ff.dirty

Re: [PATCH] Allow the user to change the temporary file name for mergetool

From: Stefan Näwe <hidden>
Date: 2016-06-15 23:02:17

Am 19.08.2014 um 14:22 schrieb Robin Rosenberg:
quoted hunk
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 <redacted>
---
 Documentation/git-mergetool.txt |  7 +++++++
 git-mergetool.sh                | 10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e846c2e..a586766 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -89,6 +89,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
+`mergtool.tmpsuffix` to be used as an extra suffix, which will be
s/mergtool/mergetool/
+appened to the temporary filenamame to lessen that problem.
s/appened/appended/
s/filenamame/filename/
quoted hunk
+
 GIT
 ---
 Part of the linkgit:git[1] suite
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 9a046b7..d7cc76c 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;}')
Stefan
-- 
----------------------------------------------------------------
/dev/random says: Confusion not only reigns, it pours.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF

[PATCH v2] Allow the user to change the temporary file name for mergetool

From: Robin Rosenberg <hidden>
Date: 2016-06-15 23:02:17

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 <redacted>
---
 Documentation/git-mergetool.txt |  7 +++++++
 git-mergetool.sh                | 10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e846c2e..80a0526 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -89,6 +89,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 9a046b7..d7cc76c 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;}')
-- 
2.1.0.rc2.6.g39c33ff.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help