On writing builtin-reset.c, a question about git-reset.sh

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

 



Hi, I'm writing builtin-reset.c and
I'm really stuck with a little code in
git-reset.sh:

if orig=$(git rev-parse --verify HEAD 2>/dev/null)
then
	echo "$orig" >"$GIT_DIR/ORIG_HEAD"
else
	rm -f "$GIT_DIR/ORIG_HEAD"
fi

My question is about when this condition
could fail (and then the rm executed), and
if you would be able to reproduce it in tests.
I couldn't, and asking for this in the IRC
didn't help me at all.

This code was introduced in 45d197, when
different reset types were introduced,
and it seems that there was a reason for
doing it that way, looking at the change.

Thanks in advance for your support.

--
Carlos
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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