summaryrefslogtreecommitdiff
path: root/git-mergetool.sh
diff options
context:
space:
mode:
authorCharles Bailey <charles@hashpling.org>2008-12-12 21:48:41 +0000
committerJunio C Hamano <gitster@pobox.com>2008-12-12 20:53:44 -0800
commit162eba8b43a0e665c8e3439191981412815cc6db (patch)
tree3c9a8f3e169479f02923b2c60f56215b07e83946 /git-mergetool.sh
parentb0169d84df4c09ed7dfcc6aea5aecd177ddda75b (diff)
downloadgit-162eba8b43a0e665c8e3439191981412815cc6db.tar.gz
mergetool: Don't keep temporary merge files unless told to
This changes git mergetool to remove the temporary files used to invoke the merge tool even if it returns non-zero. This also adds a configuration option (mergetool.keepTemporaries) to retain the previous behaviour if desired. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-mergetool.sh')
-rwxr-xr-xgit-mergetool.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 5144971647..f04240daca 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -269,6 +269,11 @@ merge_file () {
if test "$status" -ne 0; then
echo "merge of $MERGED failed" 1>&2
mv -- "$BACKUP" "$MERGED"
+
+ if test "$merge_keep_temporaries" = "false"; then
+ cleanup_temp_files
+ fi
+
return 1
fi
@@ -415,6 +420,7 @@ else
init_merge_tool_path "$merge_tool"
merge_keep_backup="$(git config --bool merge.keepBackup || echo true)"
+ merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
if test -z "$merge_tool_cmd" && ! type "$merge_tool_path" > /dev/null 2>&1; then
echo "The merge tool $merge_tool is not available as '$merge_tool_path'"