{"thread":{"id":"53192","subject":"Commit includes rename which was not staged, nor actually performed","startedAt":"2020-04-08T19:28:26Z","lastAt":"2020-04-10T06:47:15Z","messageCount":3,"participants":["Erwin Bonsma","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"395090","messageId":"CAG5PFTvqnR-aeJ=+4W5A5WKqJ8Wq3JsD7J5QjwprE+Nws+=YBg@mail.gmail.com","threadId":"53192","inReplyTo":null,"subject":"Commit includes rename which was not staged, nor actually performed","fromName":"Erwin Bonsma","fromEmail":"erwin.bonsma@gmail.com","sentAt":"2020-04-08T19:28:09Z","receivedAt":"2020-04-08T19:28:26Z","isPatch":false,"sender":{"key":"erwin.bonsma@gmail.com","avatar":null},"body":"Hi,\n\nI encountered a problem with git version 2.24.1 (Apple Git-126). When\ncommitting changes to a single file, the commit included a rename,\nwhich was not staged, nor actually carried out.\n\nMore specifically:\n\n> git status\nOn branch unwanted-rename\nChanges to be committed:\n  (use \"git restore --staged <file>...\" to unstage)\nmodified:   it.xliff\n\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\nPending/it.xliff.todo\n\n> git commit -m \"Some fixes\"\n[unwanted-rename 98098ab] Some fixes\n 2 files changed, 792 insertions(+), 826 deletions(-)\n rename de.xliff => Pending/it.xliff.todo (56%)\n\n> git log --name-only HEAD~1..HEAD\ncommit 98098abe5bc9c10a644009e6d185fa967941caca (HEAD -> unwanted-rename)\nAuthor: Erwin Bonsma <eriban@users.sourceforge.net>\nDate:   Wed Apr 8 20:47:09 2020 +0200\n\n    Some fixes\n\nPending/it.xliff.todo\nit.xliff\n\n> ls de.*\nde.xliff # The file is still present\n\n> git status\nOn branch unwanted-rename\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\nPending/it.xliff.todo # The file is still untracked\n\n> rm Pending/it.xliff.todo\n> git checkout master\n> git checkout unwanted-rename\n\nNow let's inspect the resulting revision again.\n\n> ls de.*\nls: de.xliff: No such file or directory # The file is now gone, as\ncommit suggested\n> ls Pending/it.xliff.*\nPending/it.xliff.todo # The untracked, removed file was indeed added\nto source control\n\nThe changes can be reproduced on the unwanted-rename branch available\nat https://git.code.sf.net/p/grandperspectiv/localization\n\nThe branch includes the wrong commit. To reproduce it:\n> git reset --soft HEAD~1\n> git restore --staged de.xliff\n> git restore --staged Pending/it.xliff.todo\n> git restore de.xliff\n\nNow working copy is ready for replay.\n> git status\nOn branch unwanted-rename\nYour branch is behind 'origin/unwanted-rename' by 1 commit, and can be\nfast-forwarded.\n  (use \"git pull\" to update your local branch)\n\nChanges to be committed:\n  (use \"git restore --staged <file>...\" to unstage)\nmodified:   it.xliff\n\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\nPending/it.xliff.todo\n\n> git commit -m \"Some fixes\"\n[unwanted-rename 4d1368c] Some fixes\n 2 files changed, 792 insertions(+), 826 deletions(-)\n rename de.xliff => Pending/it.xliff.todo (56%)\n\nCheers,\nErwin\n"},{"id":"395157","messageId":"20200409235719.GA46281@coredump.intra.peff.net","threadId":"53192","inReplyTo":"CAG5PFTvqnR-aeJ=+4W5A5WKqJ8Wq3JsD7J5QjwprE+Nws+=YBg@mail.gmail.com","subject":"Re: Commit includes rename which was not staged, nor actually performed","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-04-09T23:57:19Z","receivedAt":"2020-04-09T23:57:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 08, 2020 at 09:28:09PM +0200, Erwin Bonsma wrote:\n\n> The branch includes the wrong commit. To reproduce it:\n> > git reset --soft HEAD~1\n> > git restore --staged de.xliff\n> > git restore --staged Pending/it.xliff.todo\n> > git restore de.xliff\n\nThere was a bug where git-restore didn't correctly invalidate the\ncache-tree extension of the index, and could cause phantom changes to\nend up in commits.\n\nIt was fixed by e701bab3e9 (restore: invalidate cache-tree when removing\nentries with --staged, 2020-01-08), which is in v2.25.1 and up.\n\n-Peff\n"},{"id":"395169","messageId":"CAG5PFTs5CbB0+JY5qgqL91fSziNwNNEPfL8tKv30NAZGtNtWeA@mail.gmail.com","threadId":"53192","inReplyTo":"20200409235719.GA46281@coredump.intra.peff.net","subject":"Re: Commit includes rename which was not staged, nor actually performed","fromName":"Erwin Bonsma","fromEmail":"erwin.bonsma@gmail.com","sentAt":"2020-04-10T06:47:02Z","receivedAt":"2020-04-10T06:47:15Z","isPatch":false,"sender":{"key":"erwin.bonsma@gmail.com","avatar":null},"body":"Hi Peff,\n\nThanks for the analysis. I am happy to hear that it is fixed already.\n\nBtw, version 2.24.1 with the bug is part of the latest XCode release\n(11.4). Hopefully a new version of XCode will be released fairly soon,\nand will include an updated git version. Otherwise, other macOS\ndevelopers may experience (and report) similar issues. I will at least\nreport this issue with XCode.\n\nCheers,\nErwin\n\n\nOn Fri, Apr 10, 2020 at 1:57 AM Jeff King <peff@peff.net> wrote:\n>\n> On Wed, Apr 08, 2020 at 09:28:09PM +0200, Erwin Bonsma wrote:\n>\n> > The branch includes the wrong commit. To reproduce it:\n> > > git reset --soft HEAD~1\n> > > git restore --staged de.xliff\n> > > git restore --staged Pending/it.xliff.todo\n> > > git restore de.xliff\n>\n> There was a bug where git-restore didn't correctly invalidate the\n> cache-tree extension of the index, and could cause phantom changes to\n> end up in commits.\n>\n> It was fixed by e701bab3e9 (restore: invalidate cache-tree when removing\n> entries with --staged, 2020-01-08), which is in v2.25.1 and up.\n>\n> -Peff\n"}]}