Re: [PATCH] cat-file --batch / --batch-check: do not exit if hashes are missing

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

 



Johannes Sixt wrote:
With this change an invalid name and a non-existing SHA1 are treated as
"missing". But an empty name is still an error  [...]: It is the first thing
that the function checks, and there it exits with return 1.

An empty object name is actually not an error but just yields "SP missing". The "if (!obj_name) return 1;" statement doesn't dereference obj_name, so it checks for null pointers. However, batch_one_object gets called with buf.buf as its obj_name parameter, which according to api-strbuf.txt is never NULL. So probably the check is pointless and can be removed (the tests still pass); someone more knowledgeable than me should confirm this though.

(FWIW, perhaps the original author intended to catch empty input this way, but I'm not convinced that this is even sensible.)

Unrelatedly, does anyone know how to stop sha1_object_info from barfing on non-existent hashes? It causes the annoying "error: unable to find 000..." on stderr if you run "echo 0000000000000000000000000000000000000000 | git-cat-file --batch-check".

-- Lea
--
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