Re: [PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-14 Thread Jeff King
On Fri, Jul 12, 2013 at 12:30:07PM +0200, Michael Haggerty wrote: > But with particular respect to "git cat-file", I see problems: > > 1. get_ref_snapshot() would have to read all loose and packed refs > within the specified subtree, because loose refs have to be read before > packed refs. So th

Re: [PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-14 Thread Jeff King
On Sun, Jul 14, 2013 at 08:45:37PM -0700, Junio C Hamano wrote: > >> To cat-file we could add an option like "--sha1-only" or "--literal" or > >> "--no-dwim" (... better names are failing me) which would skip *all* > >> dwimming of 40-character strings. It would also assume that any shorter > >>

Re: [PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-14 Thread Junio C Hamano
Jeff King writes: >> To cat-file we could add an option like "--sha1-only" or "--literal" or >> "--no-dwim" (... better names are failing me) which would skip *all* >> dwimming of 40-character strings. It would also assume that any shorter >> strings are abbreviated SHA-1s and fail if they are n

Re: [PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-12 Thread Michael Haggerty
On 07/12/2013 11:22 AM, Jeff King wrote: > Yet another option is to consider what the check is doing, and > accomplish the same thing in a different way. The real pain is that we > are individually trying to resolve each object by hitting the filesystem > (and doing lots of silly checks on the refn

Re: [PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-12 Thread Jeff King
On Fri, Jul 12, 2013 at 10:47:46AM +0200, Michael Haggerty wrote: > > The solution feels a little hacky, but I'm not sure there is a better > > one short of reverting the warning entirely. > > > > We could also tie it to warn_ambiguous_refs (or add another config > > variable), but I don't think

Re: [PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-12 Thread Michael Haggerty
On 07/12/2013 08:20 AM, Jeff King wrote: > A common use of "cat-file --batch-check" is to feed a list > of objects from "rev-list --objects" or a similar command. > In this instance, all of our input objects are 40-byte sha1 > ids. However, cat-file has always allowed arbitrary revision > specifier

[PATCH 1/7] cat-file: disable object/refname ambiguity check for batch mode

2013-07-11 Thread Jeff King
A common use of "cat-file --batch-check" is to feed a list of objects from "rev-list --objects" or a similar command. In this instance, all of our input objects are 40-byte sha1 ids. However, cat-file has always allowed arbitrary revision specifiers, and feeds the result to get_sha1(). Fortunately