[Question] git rev-parse verify for non-existent object

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

 



In my case, I often need to use "git rev-parse --verify" to verify
if a revision exists in the repository, and this usually works:

git rev-parse --verify HEAD
afa5ff0f56bc60d1c9abe839726e7fb2105a9ca3

git rev-parse --verify afa5ff0f56bc60d1c9abe839726e7fb2105a9ca3
afa5ff0f56bc60d1c9abe839726e7fb2105a9ca3

git rev-parse --verify aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
fatal: Needed a single revision

However, when I started checking for a non-existent OID that happened
to be exactly 40 characters long, something unexpected happened.
 "git rev-parse --verify" did not produce any error messages.
I consider this to be a BUG.

git rev-parse --verify aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

I understand that using "git cat-file --batch-check="%(objectname)"
may be a potential solution, but I currently do not want to do it because
it would require significant changes and I am unsure if the behavior
would be consistent.

The simplest solution for me would be to fix "git rev-parse --verify".
What do you all think?

--
ZheNing Hu



[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