Re: Git revert cannot be aborted if the repository directory has been copied

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 3, 2024, at 03:34, Junio C Hamano wrote:
> Marco Stephan <marc.stephan96@xxxxxxxxxx> writes:
>
>> 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 '...'.
>
> I wonder if
>
>     $ git update-index --refresh
>
> is all it takes.


This is correct.  This successful test can be added to
t3501-revert-cherry-pick.sh:

```
test_expect_success 'cp -r repo in the middle of a revert' '
	test_when_finished rm -r new-repo &&
	test_when_finished rm -r copy-repo &&
	test_create_repo new-repo &&
	(
		cd new-repo &&
		echo nul >test.txt &&
		git add test.txt &&
		git commit -m "Initial commit" &&
		echo test >test.txt &&
		git add test.txt &&
		git commit -m "Changes" &&
		git revert HEAD --no-commit
	) &&
	cp -r new-repo copy-repo &&
	(
		cd copy-repo &&
		# Needed in order to avoid
		#     error: Entry test.txt not uptodate. Cannot merge.
		git update-index --refresh &&
		git revert --abort
	)
'
```

-- 
Kristoffer Haugsbakk





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux