From: Phillip Wood <phillip.wood123@gmail.com>
To: Marco Stephan <marc.stephan96@hotmail.de>,
"git@vger.kernel.org" <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: Git revert cannot be aborted if the repository directory has been copied
Date: Mon, 4 Nov 2024 09:55:23 +0000 [thread overview]
Message-ID: <c1a8eb10-ac62-49f2-a40e-36c41bbdc991@gmail.com> (raw)
In-Reply-To: <AM0PR02MB4980D186BDC087336C760132E6502@AM0PR02MB4980.eurprd02.prod.outlook.com>
On 03/11/2024 01:25, Marco Stephan wrote:
> Hello,
>
> I have encountered the following bug:
> If you copy a Git repository directory to another path while there is a revert in progress for the Git repository, "git revert --abort" does not work anymore for the copied repository. Instead, it will report an error of the following format:
> error: Entry '...' not uptodate. Cannot merge.
> fatal: Could not reset index file to revision '...'.
"git revert --abort" is a wrapper around "git reset --merge" so I wonder
if we should change "git reset --merge" to refresh the index.
Best Wishes
Phillip
> I can reproduce the bug consistently with the latest version of Git that is available for Windows (git version 2.47.0.windows.2) by performing the following steps (all command line except step 12):
> 1. mkdir test_repo
> 2. cd test_repo
> 3. git init
> 4. type nul > test.txt
> 5. git add .
> 6. git commit -m "Initial commit"
> 7. echo test > test.txt
> 8. git add .
> 9. git commit -m "Changes"
> 10. git revert HEAD --no-commit
> 11. cd ..
> 12. Manually copy test_repo to a new directory test_repo_copy using the file explorer (using e.g. "robocopy test_repo test_repo_copy /E" does not corrupt the repository)
> 13. cd test_repo_copy
> 14. git revert --abort
> This consistently produces the error "error: Entry 'test.txt' not uptodate. Cannot merge.". I would expect step 14 to work regardless of how the repository directory itself has been created. Running "git status" or "git update --really-refresh" fixes the seemingly corrupt data and the revert in progress can be aborted.
>
> I have not verified if the bug is present on other operation systems, too.
>
> With best regards
> Marco Stephan
next prev parent reply other threads:[~2024-11-04 9:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-03 1:25 Git revert cannot be aborted if the repository directory has been copied Marco Stephan
2024-11-03 2:34 ` Junio C Hamano
2024-11-03 15:04 ` Kristoffer Haugsbakk
2024-11-03 15:07 ` Kristoffer Haugsbakk
2024-11-03 15:13 ` Kristoffer Haugsbakk
2024-11-03 17:33 ` AW: " Marco Stephan
2024-11-04 9:55 ` Phillip Wood [this message]
2024-11-07 19:52 ` Marco Stephan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1a8eb10-ac62-49f2-a40e-36c41bbdc991@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=marc.stephan96@hotmail.de \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).