difftool: remove the backup file feature
Most users find the backup file feature annoying and there's no need for it since diff is supposed to be a read-only operation. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Aguilar committed
Apr 6, 2009 at 01:31 UTC
2e8af7e42b15d4f2d573329ea2593a19f45f18d3
1 file changed
+1
-33
contrib/difftool/git-difftool-helper
+1
-33
@@ -9,31 +9,7 @@
9
10
# Set GIT_DIFFTOOL_NO_PROMPT to bypass the per-file prompt.
11
should_prompt () {
12
- ! test -n "$GIT_DIFFTOOL_NO_PROMPT"
13
-}
14
-
15
-# Should we keep the backup .orig file?
16
-keep_backup_mode="$(git config --bool merge.keepBackup || echo true)"
17
-keep_backup () {
18
- test "$keep_backup_mode" = "true"
19
-}
20
-
21
-# This function manages the backup .orig file.
22
-# A backup $MERGED.orig file is created if changes are detected.
23
-cleanup_temp_files () {
24
- if test -n "$MERGED"; then
25
- if keep_backup && test "$MERGED" -nt "$BACKUP"; then
26
- test -f "$BACKUP" && mv -- "$BACKUP" "$MERGED.orig"
27
- else
28
- rm -f -- "$BACKUP"
29
- fi
30
- fi
31
-}
32
-
33
-# This is called when users Ctrl-C out of git-difftool-helper
34
-sigint_handler () {
35
- cleanup_temp_files
36
- exit 1
12
+ test -z "$GIT_DIFFTOOL_NO_PROMPT"
13
}
14
15
# This function prepares temporary files and launches the appropriate
@@ -47,12 +23,6 @@ launch_merge_tool () {
23
LOCAL="$2"
24
REMOTE="$3"
25
BASE="$1"
50
- ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
51
- BACKUP="$MERGED.BACKUP.$ext"
52
-
53
- # Create and ensure that we clean up $BACKUP
54
- test -f "$MERGED" && cp -- "$MERGED" "$BACKUP"
55
- trap sigint_handler INT
26
27
# $LOCAL and $REMOTE are temporary files so prompt
28
# the user with the real $MERGED name before launching $merge_tool.
@@ -120,8 +90,6 @@ launch_merge_tool () {
90
fi
91
;;
92
esac
123
-
124
- cleanup_temp_files
93
}
94
95
# Verifies that (difftool|mergetool).<tool>.cmd exists