crash upon "commit removedfile/newfile removedfile"

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

 



Dear Git Gurus,

Originally ran into in DANDI project [#127] while using datalad [#6558]
which uses git and git-annex.

"git commit" seems to not tolerate well whenever both removed path which became
a directory and a file under that directory  are provided to commit
invocation along with the new file path under that directory.  But it is ok
whenever removed paths (staged or not) are provided to commit.

A reproducer of the former defect and latter behavior is attached, and
execution of it on my laptop provides output pasted in full below, where you
can see the 

	+ rm p1
	+ mkdir p1
	+ touch p1/p2
	+ git add p1/p2
	+ git commit -m 2 p1/p2 p1
	error: 'p1' does not have a commit checked out
	fatal: updating files failed

problematic use case and  git commits just fine whenever removed paths
provided in commit invocation:

	+ rm p2 p3
	+ git add p2
	+ git commit -m 'removed and even staged one of them' p2 p3
	[master 209490a] removed and even staged one of them
	 2 files changed, 0 insertions(+), 0 deletions(-)
	 delete mode 100644 p2
	 delete mode 100644 p3

I think such inconsistent behavior is a defect in git. Ideally the former  "git
commit -m 2 p1/p2 p1" shouldn't crash.

	git version 2.35.1.473.g83b2b277ed
	+ git init
	Initialized empty Git repository in /home/yoh/.tmp/git-h0HvnyH/.git/
	+ touch p1
	+ git add p1
	+ git commit -m 1
	[master (root-commit) c9e0bff] 1
	 1 file changed, 0 insertions(+), 0 deletions(-)
	 create mode 100644 p1
	+ rm p1
	+ mkdir p1
	+ touch p1/p2
	+ git add p1/p2
	+ git commit -m 2 p1/p2 p1
	error: 'p1' does not have a commit checked out
	fatal: updating files failed
	+ echo 'that did not work when imho should have!'
	that did not work when imho should have!
	+ git commit -m 2 p1/p2
	[master 446b8dc] 2
	 1 file changed, 0 insertions(+), 0 deletions(-)
	 rename p1 => p1/p2 (100%)
	+ echo 'done -- committed just fine'
	done -- committed just fine
	+ touch p2 p3
	+ git add p2 p3
	+ git commit -m 3 p2 p3
	[master 19ffa50] 3
	 2 files changed, 0 insertions(+), 0 deletions(-)
	 create mode 100644 p2
	 create mode 100644 p3
	+ rm p2 p3
	+ git add p2
	+ git commit -m 'removed and even staged one of them' p2 p3
	[master 209490a] removed and even staged one of them
	 2 files changed, 0 insertions(+), 0 deletions(-)
	 delete mode 100644 p2
	 delete mode 100644 p3
	+ echo 'and it worked just fine'


[#127] https://github.com/dandi/dandisets/issues/127#issuecomment-1066934910
[#6558]  DataLad bugreport https://github.com/datalad/datalad/issues/6558

-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        

Attachment: git-commit-removed.sh
Description: Bourne shell script

Attachment: signature.asc
Description: PGP signature


[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