* Commit includes rename which was not staged, nor actually performed
@ 2020-04-08 19:28 Erwin Bonsma
2020-04-09 23:57 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Erwin Bonsma @ 2020-04-08 19:28 UTC (permalink / raw)
To: git
Hi,
I encountered a problem with git version 2.24.1 (Apple Git-126). When
committing changes to a single file, the commit included a rename,
which was not staged, nor actually carried out.
More specifically:
> git status
On branch unwanted-rename
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: it.xliff
Untracked files:
(use "git add <file>..." to include in what will be committed)
Pending/it.xliff.todo
> git commit -m "Some fixes"
[unwanted-rename 98098ab] Some fixes
2 files changed, 792 insertions(+), 826 deletions(-)
rename de.xliff => Pending/it.xliff.todo (56%)
> git log --name-only HEAD~1..HEAD
commit 98098abe5bc9c10a644009e6d185fa967941caca (HEAD -> unwanted-rename)
Author: Erwin Bonsma <eriban@users.sourceforge.net>
Date: Wed Apr 8 20:47:09 2020 +0200
Some fixes
Pending/it.xliff.todo
it.xliff
> ls de.*
de.xliff # The file is still present
> git status
On branch unwanted-rename
Untracked files:
(use "git add <file>..." to include in what will be committed)
Pending/it.xliff.todo # The file is still untracked
> rm Pending/it.xliff.todo
> git checkout master
> git checkout unwanted-rename
Now let's inspect the resulting revision again.
> ls de.*
ls: de.xliff: No such file or directory # The file is now gone, as
commit suggested
> ls Pending/it.xliff.*
Pending/it.xliff.todo # The untracked, removed file was indeed added
to source control
The changes can be reproduced on the unwanted-rename branch available
at https://git.code.sf.net/p/grandperspectiv/localization
The branch includes the wrong commit. To reproduce it:
> git reset --soft HEAD~1
> git restore --staged de.xliff
> git restore --staged Pending/it.xliff.todo
> git restore de.xliff
Now working copy is ready for replay.
> git status
On branch unwanted-rename
Your branch is behind 'origin/unwanted-rename' by 1 commit, and can be
fast-forwarded.
(use "git pull" to update your local branch)
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: it.xliff
Untracked files:
(use "git add <file>..." to include in what will be committed)
Pending/it.xliff.todo
> git commit -m "Some fixes"
[unwanted-rename 4d1368c] Some fixes
2 files changed, 792 insertions(+), 826 deletions(-)
rename de.xliff => Pending/it.xliff.todo (56%)
Cheers,
Erwin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Commit includes rename which was not staged, nor actually performed
2020-04-08 19:28 Commit includes rename which was not staged, nor actually performed Erwin Bonsma
@ 2020-04-09 23:57 ` Jeff King
2020-04-10 6:47 ` Erwin Bonsma
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2020-04-09 23:57 UTC (permalink / raw)
To: Erwin Bonsma; +Cc: git
On Wed, Apr 08, 2020 at 09:28:09PM +0200, Erwin Bonsma wrote:
> The branch includes the wrong commit. To reproduce it:
> > git reset --soft HEAD~1
> > git restore --staged de.xliff
> > git restore --staged Pending/it.xliff.todo
> > git restore de.xliff
There was a bug where git-restore didn't correctly invalidate the
cache-tree extension of the index, and could cause phantom changes to
end up in commits.
It was fixed by e701bab3e9 (restore: invalidate cache-tree when removing
entries with --staged, 2020-01-08), which is in v2.25.1 and up.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Commit includes rename which was not staged, nor actually performed
2020-04-09 23:57 ` Jeff King
@ 2020-04-10 6:47 ` Erwin Bonsma
0 siblings, 0 replies; 3+ messages in thread
From: Erwin Bonsma @ 2020-04-10 6:47 UTC (permalink / raw)
To: Jeff King; +Cc: git
Hi Peff,
Thanks for the analysis. I am happy to hear that it is fixed already.
Btw, version 2.24.1 with the bug is part of the latest XCode release
(11.4). Hopefully a new version of XCode will be released fairly soon,
and will include an updated git version. Otherwise, other macOS
developers may experience (and report) similar issues. I will at least
report this issue with XCode.
Cheers,
Erwin
On Fri, Apr 10, 2020 at 1:57 AM Jeff King <peff@peff.net> wrote:
>
> On Wed, Apr 08, 2020 at 09:28:09PM +0200, Erwin Bonsma wrote:
>
> > The branch includes the wrong commit. To reproduce it:
> > > git reset --soft HEAD~1
> > > git restore --staged de.xliff
> > > git restore --staged Pending/it.xliff.todo
> > > git restore de.xliff
>
> There was a bug where git-restore didn't correctly invalidate the
> cache-tree extension of the index, and could cause phantom changes to
> end up in commits.
>
> It was fixed by e701bab3e9 (restore: invalidate cache-tree when removing
> entries with --staged, 2020-01-08), which is in v2.25.1 and up.
>
> -Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-10 6:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 19:28 Commit includes rename which was not staged, nor actually performed Erwin Bonsma
2020-04-09 23:57 ` Jeff King
2020-04-10 6:47 ` Erwin Bonsma
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).