public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Robin Rosenberg <robin.rosenberg@dewire•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v2] Allow the user to change the temporary file name for mergetool
Date: Tue, 19 Aug 2014 10:02:47 -0700	[thread overview]
Message-ID: <xmqqa970wgy0.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1408460112-6206-1-git-send-email-robin.rosenberg@dewire.com> (Robin Rosenberg's message of "Tue, 19 Aug 2014 16:55:12 +0200")

Robin Rosenberg <robin.rosenberg@dewire•com> writes:

> 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?

>
> 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;}')

  reply	other threads:[~2014-08-19 17:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19 12:22 [PATCH] Allow the user to change the temporary file name for mergetool Robin Rosenberg
2014-08-19 12:52 ` Stefan Näwe
2014-08-19 14:55   ` [PATCH v2] " Robin Rosenberg
2014-08-19 17:02     ` Junio C Hamano [this message]
2014-08-19 17:15       ` [PATCH v3] " Robin Rosenberg
2014-08-19 18:01         ` Junio C Hamano
2014-08-19 20:36         ` Johannes Sixt
2014-08-19 22:14           ` Junio C Hamano
2014-08-20  7:24             ` Robin Rosenberg
2014-08-21  7:47               ` [PATCH v4] " Robin Rosenberg
2014-08-21 20:04                 ` Junio C Hamano
2014-08-20  7:22         ` [PATCH v3] " Stefan Näwe

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=xmqqa970wgy0.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=robin.rosenberg@dewire$(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