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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 19, 2014, 17:02 UTC
Message-ID
<xmqqa970wgy0.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1408460112-6206-1-git-send-email-robin.rosenberg@dewire.com>
Robin Rosenberg <robin.rosenberg@dewire.com> writes:
Show 11 quoted lines
> 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>
> ---
>  Documentation/git-mergetool.txt |  7 +++++++
>  git-mergetool.sh                | 10 ++++++----
>  2 files changed, 13 insertions(+), 4 deletions(-)
No updates to Documentation/config.txt to describe the new variable?
Show 47 quoted lines
>
> 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;}')
Previous: Robin RosenbergNext: Robin Rosenberg
Message 4 of 12 in “Allow the user to change the temporary file name for mergetool”
  1. Allow the user to change the temporary file name for mergetoolRobin Rosenberg, Aug 19, 2014
  2. Stefan NäweAug 19, 2014
  3. Allow the user to change the temporary file name for mergetoolRobin Rosenberg, Aug 19, 2014
  4. Junio C HamanoAug 19, 2014
  5. Allow the user to change the temporary file name for mergetoolRobin Rosenberg, Aug 19, 2014
  6. Junio C HamanoAug 19, 2014
  7. Johannes SixtAug 19, 2014
  8. Junio C HamanoAug 19, 2014
  9. Robin RosenbergAug 20, 2014
  10. Allow the user to change the temporary file name for mergetoolRobin Rosenberg, Aug 21, 2014
  11. Junio C HamanoAug 21, 2014
  12. Stefan NäweAug 20, 2014

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.