git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 05/14] difftool: remove the backup file feature

From
David Aguilar <davvid@gmail.com>
Date
Apr 6, 2009, 08:31 UTC
Message-ID
<1239006689-14695-6-git-send-email-davvid@gmail.com>
In-Reply-To
<1239006689-14695-5-git-send-email-davvid@gmail.com>

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>
---
 contrib/difftool/git-difftool-helper |   34 +---------------------------------
 1 files changed, 1 insertions(+), 33 deletions(-)
diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
index ef684b6..e74a274 100755
--- a/contrib/difftool/git-difftool-helper
+++ b/contrib/difftool/git-difftool-helper
@@ -9,31 +9,7 @@
 
 # Set GIT_DIFFTOOL_NO_PROMPT to bypass the per-file prompt.
 should_prompt () {
-	! test -n "$GIT_DIFFTOOL_NO_PROMPT"
-}
-
-# Should we keep the backup .orig file?
-keep_backup_mode="$(git config --bool merge.keepBackup || echo true)"
-keep_backup () {
-	test "$keep_backup_mode" = "true"
-}
-
-# This function manages the backup .orig file.
-# A backup $MERGED.orig file is created if changes are detected.
-cleanup_temp_files () {
-	if test -n "$MERGED"; then
-		if keep_backup && test "$MERGED" -nt "$BACKUP"; then
-			test -f "$BACKUP" && mv -- "$BACKUP" "$MERGED.orig"
-		else
-			rm -f -- "$BACKUP"
-		fi
-	fi
-}
-
-# This is called when users Ctrl-C out of git-difftool-helper
-sigint_handler () {
-	cleanup_temp_files
-	exit 1
+	test -z "$GIT_DIFFTOOL_NO_PROMPT"
 }
 
 # This function prepares temporary files and launches the appropriate
@@ -47,12 +23,6 @@ launch_merge_tool () {
 	LOCAL="$2"
 	REMOTE="$3"
 	BASE="$1"
-	ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
-	BACKUP="$MERGED.BACKUP.$ext"
-
-	# Create and ensure that we clean up $BACKUP
-	test -f "$MERGED" && cp -- "$MERGED" "$BACKUP"
-	trap sigint_handler INT
 
 	# $LOCAL and $REMOTE are temporary files so prompt
 	# the user with the real $MERGED name before launching $merge_tool.
@@ -120,8 +90,6 @@ launch_merge_tool () {
 		fi
 		;;
 	esac
-
-	cleanup_temp_files
 }
 
 # Verifies that (difftool|mergetool).<tool>.cmd exists
-- 
1.6.2.2.414.g81aa9
Previous: David AguilarNext: David Aguilar
Message 6 of 17 in “git-{merge,diff}tool refactor round three”
  1. David AguilarApr 6, 2009
  2. 01/14 doc/merge-config: list ecmerge as a built-in merge toolDavid Aguilar, Apr 6, 2009
  3. 02/14 git-mergetool/difftool: make (g)vimdiff workable under WindowsDavid Aguilar, Apr 6, 2009
  4. 03/14 git-mergetool: add new merge tool TortoiseMergeDavid Aguilar, Apr 6, 2009
  5. 04/14 difftool: remove merge options for opendiff, tkdiff, kdiff3 and xxdiffDavid Aguilar, Apr 6, 2009
  6. 05/14 difftool: remove the backup file featureDavid Aguilar, Apr 6, 2009
  7. 06/14 difftool: use perl built-ins when testing for msysDavid Aguilar, Apr 6, 2009
  8. 07/14 difftool: add a -y shortcut for --no-promptDavid Aguilar, Apr 6, 2009
  9. 08/14 difftool/mergetool: add diffuse as merge and diff toolDavid Aguilar, Apr 6, 2009
  10. 09/14 difftool: move 'git-difftool' out of contribDavid Aguilar, Apr 6, 2009
  11. 10/14 difftool: add various git-difftool testsDavid Aguilar, Apr 6, 2009
  12. 11/14 difftool: add support for a difftool.prompt config variableDavid Aguilar, Apr 6, 2009
  13. 12/14 bash completion: add git-difftoolDavid Aguilar, Apr 6, 2009
  14. 13/14 mergetool: use $( ... ) instead of `backticks`David Aguilar, Apr 6, 2009
  15. 14/14 difftool/mergetool: refactor commands to use git-mergetool--libDavid Aguilar, Apr 6, 2009
  16. Markus HeidelbergApr 6, 2009
  17. Markus HeidelbergApr 6, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.