summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b0169d8)
raw | patch | inline | side by side (parent: b0169d8)
author | Charles Bailey <charles@hashpling.org> | |
Fri, 12 Dec 2008 21:48:41 +0000 (21:48 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 13 Dec 2008 04:53:44 +0000 (20:53 -0800) |
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>
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>
Documentation/config.txt | patch | blob | history | |
git-mergetool.sh | patch | blob | history |
index bc5642d603238ad07c40315ecef228b8fed38d98..3d5a8df0cf8e46256353b8884bc3c7a745560467 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
is set to `false` then this file is not preserved. Defaults to
`true` (i.e. keep the backup files).
+mergetool.keepTemporaries::
+ When invoking a custom merge tool, git uses a set of temporary
+ files to pass to the tool. If the tool returns an error and this
+ variable is set to `true`, then these temporary files will be
+ preserved, otherwise they will be removed after the tool has
+ exited. Defaults to `false`.
+
mergetool.prompt::
Prompt before each invocation of the merge resolution program.
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 5144971647c177533bfe6cdd1be974bd60555728..f04240dacaba88bfdac49b0e6e14047b1008a956 100755 (executable)
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
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
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'"