public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: "Brodie Rao" <brodie@sf•io>,
	git@vger•kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Subject: Re: [PATCH] sha1_name: don't resolve refs when core.warnambiguousrefs is false
Date: Tue, 07 Jan 2014 12:31:57 -0800	[thread overview]
Message-ID: <xmqqd2k3cz42.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140107195844.GA21812@sigill.intra.peff.net> (Jeff King's message of "Tue, 7 Jan 2014 14:58:44 -0500")

Jeff King <peff@peff•net> writes:

> On Tue, Jan 07, 2014 at 11:38:15AM -0800, Junio C Hamano wrote:
>
>> >> > Alternatively, I guess "cat-file
>> >> > --batch" could just turn off warn_ambiguous_refs itself.
>> >> 
>> >> Sounds like a sensible way to go, perhaps on top of this change?
>> >
>> > The downside is that we would not warn about ambiguous refs anymore,
>> > even if the user was expecting it to. I don't know if that matters much.
>> 
>> That is true already with or without Brodie's change, isn't it?
>> With warn_on_object_refname_ambiguity, "cat-file --batch" makes us
>> ignore core.warnambigousrefs setting.  If we redo 25fba78d
>> (cat-file: disable object/refname ambiguity check for batch mode,
>> 2013-07-12) to unconditionally disable warn_ambiguous_refs in
>> "cat-file --batch" and get rid of warn_on_object_refname_ambiguity,
>> the end result would be the same, no?
>
> No, I don't think the end effect is the same (or maybe we are not
> talking about the same thing. :) ).
>
> There are two ambiguity situations:
>
>   1. Ambiguous non-fully-qualified refs (e.g., same tag and head name).
>
>   2. 40-hex sha1 object names which might also be unqualified ref names.
>
> Prior to 25ffba78d, cat-file checked both (like all the rest of git).
> But checking (2) is very expensive,...

Ahh, of course.  Sorry for forgetting about 1.

> The two options I was musing over earlier today were (all on top of
> Brodie's patch):
>
>   a. Revert 25ffba78d. With Brodie's patch, core.warnAmbiguousRefs
>      disables _both_ warnings. So we default to safe-but-slow, but
>      people who care about performance can turn off ambiguity warnings.
>      The downside is that you have to know to turn it off manually (and
>      it's a global config flag, so you end up turning it off
>      _everywhere_, not just in big queries where it matters).

Or "git -c core.warnambiguousrefs=false cat-file --batch", but I
think a more important point is that it is no longer automatic for
known-to-be-heavy operations, and I agree with you that it is a
downside.

>   b. Revert 25ffba78d, but then on top of it just turn off
>      warn_ambiguous_refs unconditionally in "cat-file --batch-check".
>      The downside is that we drop the safety from (1). The upside is
>      that the code is a little simpler, as we drop the extra flag.
>
> And obviously:
>
>   c. Just leave it at Brodie's patch with nothing else on top.
>
> My thinking in favor of (b) was basically "does anybody actually care
> about ambiguous refs in this situation anyway?". If they do, then I
> think (c) is my preferred choice.

OK.  I agree with that line of thinking.  Let's take it one step at
a time, i.e. do c. and also use warn_on_object_refname_ambiguity in
"rev-list --stdin" first and leave the simplification (i.e. b.) for
later.

>> > I kind of feel in the --batch situation that it is somewhat useless (I
>> > wonder if "rev-list --stdin" should turn it off, too).
>> 
>> I think doing the same as "cat-file --batch" in "rev-list --stdin"
>> makes sense.  Both interfaces are designed to grok extended SHA-1s,
>> and full 40-hex object names could be ambiguous and we are missing
>> the warning for them.
>
> I'm not sure I understand what you are saying. We _do_ have the warning
> for "rev-list --stdin" currently. We do _not_ have the warning for
> "cat-file --batch", since my 25ffba78d.

What I wanted to say was that we would be discarding the safety for
"rev-list --stdin" with the same argument as we did for "cat-file
--batch".  If the argument for the earlier "cat-file --batch" were
"this interface only takes raw 40-hex object names", then the
situation would have been different, but that is not the case.

> I was wondering if rev-list should go the same way as 25ffba78d,
> for efficiency reasons (e.g., think piping to "rev-list --no-walk
> --stdin").

Yes, and I was trying to agree with that, but apparently I failed
;-)

  reply	other threads:[~2014-01-07 20:32 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  3:32 [PATCH] sha1_name: don't resolve refs when core.warnambiguousrefs is false Brodie Rao
2014-01-07  3:35 ` Brodie Rao
2014-01-07 17:13   ` Jeff King
2014-01-07 17:51     ` Junio C Hamano
2014-01-07 17:52       ` Jeff King
2014-01-07 19:38         ` Junio C Hamano
2014-01-07 19:58           ` Jeff King
2014-01-07 20:31             ` Junio C Hamano [this message]
2014-01-07 22:08               ` Jeff King
2014-01-07 22:10                 ` [PATCH 1/4] cat-file: refactor error handling of batch_objects Jeff King
2014-01-07 22:10                 ` [PATCH 2/4] cat-file: fix a minor memory leak in batch_objects Jeff King
2014-01-07 22:10                 ` [PATCH 3/4] cat-file: restore ambiguity warning flag " Jeff King
2014-01-07 22:11                 ` [PATCH 4/4] revision: turn off object/refname ambiguity check for --stdin Jeff King
2014-01-07 23:56                 ` [PATCH v2] speeding up 40-hex ambiguity check Jeff King
2014-01-07 23:57                   ` [PATCH v2 1/5] cat-file: refactor error handling of batch_objects Jeff King
2014-01-07 23:57                   ` [PATCH v2 2/5] cat-file: fix a minor memory leak in batch_objects Jeff King
2014-01-07 23:58                   ` [PATCH v2 3/5] refs: teach for_each_ref a flag to avoid recursion Jeff King
2014-01-08  3:47                     ` [PATCH v3 " Jeff King
2014-01-08 10:23                       ` Jeff King
2014-01-08 11:29                       ` Michael Haggerty
2014-01-09 21:49                         ` Jeff King
2014-01-10  8:59                           ` Michael Haggerty
2014-01-10  9:15                             ` Jeff King
2014-01-09 17:51                       ` Junio C Hamano
2014-01-09 21:55                         ` Jeff King
2014-01-07 23:59                   ` [PATCH v2 4/5] get_sha1: speed up ambiguous 40-hex test Jeff King
2014-01-08 16:09                     ` Michael Haggerty
2014-01-09 18:25                       ` Junio C Hamano
2014-01-10  9:41                       ` Jeff King
2014-01-14  9:50                         ` Jeff King
2014-01-14 11:34                           ` Michael Haggerty
2014-01-08  0:00                   ` [PATCH v2 5/5] get_sha1: drop object/refname ambiguity flag Jeff King
2014-01-08 16:34                     ` Michael Haggerty
2014-01-07  6:45 ` [PATCH] sha1_name: don't resolve refs when core.warnambiguousrefs is false Duy Nguyen
2014-01-07 17:24 ` Junio C Hamano
2014-01-07 19:23   ` Brodie Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd2k3cz42.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=brodie@sf$(echo .)io \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox