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

[PATCH/RFC] Allow file removal when "git commit --all" is used.

From
Junio C Hamano <junkio@cox.net>
Date
Aug 18, 2005, 07:59 UTC
Message-ID
<7v64u3k74m.fsf@assigned-by-dhcp.cox.net>

After you deleted files from your working tree, automatic git-update-cache used when the "--all" flag is given to "git commit" barfs because it lacks the --remove flag.

It can be argued that this is a feature; people should be careful and something with a grave consequence like removing files should be done manually, in which case the current behaviour may be OK.

The patch is for people who thinks the user who uses the "--all" flag deserves the danger that comes with the convenience.

Comments?
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-commit-script b/git-commit-script
--- a/git-commit-script
+++ b/git-commit-script
@@ -88,13 +88,13 @@ esac
 case "$all,$#" in
 t,*)
 	git-diff-files --name-only -z |
-	xargs -0 git-update-cache -q --
+	xargs -0 git-update-cache -q --remove --
 	;;
 ,0)
 	;;
 *)
 	git-diff-files --name-only -z "$@" |
-	xargs -0 git-update-cache -q --
+	xargs -0 git-update-cache -q --remove --
 	;;
 esac || exit 1
 git-update-cache -q --refresh || exit 1
Next: Johannes Schindelin
Message 1 of 4 in “Allow file removal when "git commit --all" is used.”
  1. Allow file removal when "git commit --all" is used.Junio C Hamano, Aug 18, 2005
  2. Johannes SchindelinAug 18, 2005
  3. Junio C HamanoAug 19, 2005
  4. Johannes SchindelinAug 19, 2005

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.