git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Josef Ridky <jridky@redhat.com>
To: git@vger.kernel.org
Subject: [PATCH 1/2] Feature Request: user defined suffix for temp files created by git-mergetool
Date: Thu, 6 Oct 2016 08:43:02 -0400 (EDT)	[thread overview]
Message-ID: <1911899288.2172724.1475757782111.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1214659824.1976049.1475738509473.JavaMail.zimbra@redhat.com>

This is the first of two variant for request to add option to change
suffix of name of temporary files generated by git mergetool. This
change is requested for cases, when is git mergetool used for local
comparision between two version of same package during package rebase.

Signed-off-by: Josef Ridky <jridky@redhat.com>
---
 Documentation/git-mergetool.txt |  7 ++++++-
 git-mergetool.sh                | 23 ++++++++++++++++++-----
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e846c2e..a212cef 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -8,7 +8,7 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
 SYNOPSIS
 --------
 [verse]
-'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
+'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [-l | --local] [<file>...]
 
 DESCRIPTION
 -----------
@@ -79,6 +79,11 @@ success of the resolution after the custom tool has exited.
 	Prompt before each invocation of the merge resolution program
 	to give the user a chance to skip the path.
 
+-l::
+--local::
+	Change suffix of name of temporary files generated by git
+	mergetool from `_REMOTE_` and `_LOCAL_` to `_OLD_` and `_NEW_`.
+
 TEMPORARY FILES
 ---------------
 `git mergetool` creates `*.orig` backup files while resolving merges.
diff --git a/git-mergetool.sh b/git-mergetool.sh
index bf86270..1e04368 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -8,10 +8,11 @@
 # at the discretion of Junio C Hamano.
 #
 
-USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
+USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-l|--local] [file to merge] ...'
 SUBDIRECTORY_OK=Yes
 NONGIT_OK=Yes
 OPTIONS_SPEC=
+LOCAL_MODE=false
 TOOL_MODE=merge
 . git-sh-setup
 . git-mergetool--lib
@@ -271,10 +272,19 @@ merge_file () {
 		BASE=${BASE##*/}
 	fi
 
-	BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext"
-	LOCAL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_$$$ext"
-	REMOTE="$MERGETOOL_TMPDIR/${BASE}_REMOTE_$$$ext"
-	BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext"
+	if test "$LOCAL_MODE"
+	then
+
+		BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext"
+		LOCAL="$MERGETOOL_TMPDIR/${BASE}_NEW_$$$ext"
+		REMOTE="$MERGETOOL_TMPDIR/${BASE}_OLD_$$$ext"
+		BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext"
+	else
+		BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext"
+		LOCAL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_$$$ext"
+		REMOTE="$MERGETOOL_TMPDIR/${BASE}_REMOTE_$$$ext"
+		BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext"
+	fi
 
 	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;}')
@@ -396,6 +406,9 @@ do
 	--prompt)
 		prompt=true
 		;;
+	-l|--local)
+		LOCAL_MODE=true
+		;;
 	--)
 		shift
 		break
-- 
2.7.4

  reply	other threads:[~2016-10-06 13:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <88486231.114620.1475474318974.JavaMail.zimbra@redhat.com>
2016-10-03  6:36 ` Feature Request: user defined suffix for temp files created by git-mergetool Josef Ridky
2016-10-03 15:18   ` Anatoly Borodin
2016-10-04  5:18     ` Josef Ridky
2016-10-05  9:47       ` David Aguilar
2016-10-05 10:19         ` Josef Ridky
2016-10-05  7:47   ` Josef Ridky
2016-10-05 16:05     ` Junio C Hamano
2016-10-06  6:47       ` Josef Ridky
2016-10-05 21:04     ` Johannes Sixt
2016-10-06  7:21       ` Josef Ridky
2016-10-06 12:43         ` Josef Ridky [this message]
2016-10-06 13:09           ` [PATCH 2/2] " Josef Ridky
2016-10-06 17:06             ` Junio C Hamano
2016-10-12  8:24               ` [PATCH v2 " Josef Ridky
2016-10-12 17:59                 ` Junio C Hamano
2016-10-13  4:55                   ` David Aguilar
2016-10-13  5:13           ` [PATCH 1/2] " David Aguilar
2016-10-06 16:58         ` Junio C Hamano
2016-10-06 15:54       ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1911899288.2172724.1475757782111.JavaMail.zimbra@redhat.com \
    --to=jridky@redhat.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).