{"thread":{"id":"59948","subject":"Possible Bug with `git commit -a` in v2.41.0","startedAt":"2023-07-03T18:19:55Z","lastAt":"2023-07-03T19:29:56Z","messageCount":2,"participants":["Dylan Brotherston","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"479149","messageId":"ZKMRAkH1r2mQ85Ff@vx12.orchestra.cse.unsw.EDU.AU","threadId":"59948","inReplyTo":null,"subject":"Possible Bug with `git commit -a` in v2.41.0","fromName":"Dylan Brotherston","fromEmail":"dylanb@cse.unsw.edu.au","sentAt":"2023-07-03T18:18:42Z","receivedAt":"2023-07-03T18:19:55Z","isPatch":false,"sender":{"key":"dylanb@cse.unsw.edu.au","avatar":null},"body":"`git commit -a` is unable to remove the last file in the index in v2.41.0\n\n \n\ncomparing git version 2.30.2 to 2.41.0\n\n \n\n```\n\n$ git --version\n\ngit version 2.30.2\n\n$ git init\n\nInitialized empty Git repository in /tmp/tmp.vXqq6iVaqq/.git/\n\n$ echo \"foo\" > a\n\n$ git add a\n\n$ git commit -m \"C1\"\n\n[master (root-commit) b3abdc4] C1\n\n 1 file changed, 1 insertion(+)\n\n create mode 100644 a\n\n$ rm a\n\n$ git commit -a -m \"C2\"\n\n[master c3d4c44] C2\n\n 1 file changed, 1 deletion(-)\n\n delete mode 100644 a\n\n```\n\n \n\n```\n\n$ git --version\n\ngit version 2.41.0\n\n$ git init\n\nInitialized empty Git repository in /tmp/tmp.vXqq6iVaqq/.git/\n\n$ echo \"foo\" > a\n\n$ git add a\n\n$ git commit -m \"C1\"\n\n[master (root-commit) af7c07d] C1\n\n 1 file changed, 1 insertion(+)\n\n create mode 100644 a\n\n$ rm a\n\n$ git commit -a -m \"C2\"\n\nOn branch master\n\nChanges not staged for commit:\n\n  (use \"git add/rm <file>...\" to update what will be committed)\n\n  (use \"git restore <file>...\" to discard changes in working directory)\n\n        deleted:    a\n\n \n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n```\n\n \n\n- Dylan Brotherston\n"},{"id":"479163","messageId":"20230703192952.GB3546592@coredump.intra.peff.net","threadId":"59948","inReplyTo":"ZKMRAkH1r2mQ85Ff@vx12.orchestra.cse.unsw.EDU.AU","subject":"Re: Possible Bug with `git commit -a` in v2.41.0","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T19:29:52Z","receivedAt":"2023-07-03T19:29:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 04, 2023 at 04:18:42AM +1000, Dylan Brotherston wrote:\n\n> $ git init\n> Initialized empty Git repository in /tmp/tmp.vXqq6iVaqq/.git/\n> \n> $ echo \"foo\" > a\n> $ git add a\n> $ git commit -m \"C1\"\n> [master (root-commit) af7c07d] C1\n>  1 file changed, 1 insertion(+)\n>  create mode 100644 a\n> \n> $ rm a\n> $ git commit -a -m \"C2\"\n> On branch master\n> Changes not staged for commit:\n>   (use \"git add/rm <file>...\" to update what will be committed)\n>   (use \"git restore <file>...\" to discard changes in working directory)\n>         deleted:    a\n> \n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nThanks for an easy reproduction recipe. I think this bug has already\nbeen fixed by 2ee045eea1 (commit -a -m: allow the top-level tree to\nbecome empty again, 2023-06-29). That's currently in 'next', and slated\nto merge to 'master' soon (and hopefully will make it to 'maint' for\na v2.41.1 release).\n\n-Peff\n"}]}