From: Michael Rappazzo <rappazzo@gmail.com>
To: davvid@gmail.com, ssaasen@atlassian.com, john@keeping.me.uk,
gitster@pobox.com
Cc: git@vger.kernel.org, Michael Rappazzo <rappazzo@gmail.com>
Subject: [PATCH] mergetools: add config option to disable auto-merge
Date: Tue, 16 Jun 2015 17:35:14 -0400 [thread overview]
Message-ID: <1434490514-36204-2-git-send-email-rappazzo@gmail.com> (raw)
In-Reply-To: <1434490514-36204-1-git-send-email-rappazzo@gmail.com>
For some mergetools, the current invocation of git mergetool will
include an auto-merge flag. By default the flag is included, however if
the git config option 'merge.automerge' is set to 'false', then that
flag will now be omitted.
Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
---
Documentation/config.txt | 6 ++++++
Documentation/git-mergetool.txt | 19 +++++++++++++------
mergetools/araxis | 4 +++-
mergetools/diffmerge | 4 +++-
mergetools/kdiff3 | 4 +++-
5 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 43bb53c..658d8f7 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1864,6 +1864,12 @@ mergetool.meld.hasOutput::
to `true` tells Git to unconditionally use the `--output` option,
and `false` avoids using `--output`.
+mergetool.automerge::
+ When invoking a custom merge tool which includes an auto-merge
+ option, Git will include that option by default. If this variable
+ is set to `false` then the auto-merge option is not used when
+ invoking the custom merge tool.
+
mergetool.keepBackup::
After performing a merge, the original file with conflict markers
can be saved as a file with a `.orig` extension. If this variable
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e846c2e..3461d3a 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -79,16 +79,23 @@ 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.
-TEMPORARY FILES
----------------
-`git mergetool` creates `*.orig` backup files while resolving merges.
-These are safe to remove once a file has been merged and its
-`git mergetool` session has completed.
-
+CONFIGURATION OPTIONS
+---------------------
+mergetool.keepBackup::
+ `git mergetool` creates `*.orig` backup files while resolving merges.
+ These are safe to remove once a file has been merged and its
+ `git mergetool` session has completed.
++
Setting the `mergetool.keepBackup` configuration variable to `false`
causes `git mergetool` to automatically remove the backup as files
are successfully merged.
+mergetool.automerge::
+ For some mergetools, the current invocation of git mergetool will
+ include an auto-merge flag. By default the flag is included, however if
+ the git config option `merge.automerge` is set to `false`, then that
+ flag will be omitted.
+
GIT
---
Part of the linkgit:git[1] suite
diff --git a/mergetools/araxis b/mergetools/araxis
index 64f97c5..00e63da 100644
--- a/mergetools/araxis
+++ b/mergetools/araxis
@@ -6,7 +6,9 @@ merge_cmd () {
touch "$BACKUP"
if $base_present
then
- "$merge_tool_path" -wait -merge -3 -a1 \
+ automerge="-merge"
+ test "$(git config --get --bool mergetool.automerge)" = false && automerge=''
+ "$merge_tool_path" -wait ${automerge} -3 -a1 \
"$BASE" "$LOCAL" "$REMOTE" "$MERGED" >/dev/null 2>&1
else
"$merge_tool_path" -wait -2 \
diff --git a/mergetools/diffmerge b/mergetools/diffmerge
index f138cb4..287489b 100644
--- a/mergetools/diffmerge
+++ b/mergetools/diffmerge
@@ -5,7 +5,9 @@ diff_cmd () {
merge_cmd () {
if $base_present
then
- "$merge_tool_path" --merge --result="$MERGED" \
+ automerge="--merge"
+ test "$(git config --get --bool mergetool.automerge)" = false && automerge=''
+ "$merge_tool_path" ${automerge} --result="$MERGED" \
"$LOCAL" "$BASE" "$REMOTE"
else
"$merge_tool_path" --merge \
diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
index 793d129..8e1d063 100644
--- a/mergetools/kdiff3
+++ b/mergetools/kdiff3
@@ -7,7 +7,9 @@ diff_cmd () {
merge_cmd () {
if $base_present
then
- "$merge_tool_path" --auto \
+ automerge="--auto"
+ test "$(git config --get --bool mergetool.automerge)" = false && automerge=''
+ "$merge_tool_path" ${automerge} \
--L1 "$MERGED (Base)" \
--L2 "$MERGED (Local)" \
--L3 "$MERGED (Remote)" \
--
2.4.2
next prev parent reply other threads:[~2015-06-16 21:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 21:35 [PATCH] mergetools: add config option to disable auto-merge Michael Rappazzo
2015-06-16 21:35 ` Michael Rappazzo [this message]
2015-06-17 19:41 ` Junio C Hamano
2015-06-18 2:27 ` Mike Rappazzo
2015-06-18 8:42 ` David Aguilar
2015-06-18 15:14 ` Mike Rappazzo
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=1434490514-36204-2-git-send-email-rappazzo@gmail.com \
--to=rappazzo@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=john@keeping.me.uk \
--cc=ssaasen@atlassian.com \
/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.
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 NNTP newsgroup(s).