git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH v2 1/1] pack-objects: ignore ambiguous object warnings
Date: Wed, 7 Nov 2018 04:21:29 -0500	[thread overview]
Message-ID: <20181107092129.GA8671@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqq7ehpclsa.fsf@gitster-ct.c.googlers.com>

On Wed, Nov 07, 2018 at 05:52:05PM +0900, Junio C Hamano wrote:

> Junio C Hamano <gitster@pobox.com> writes:
> 
> > The fix here is similar to 4c30d50 "rev-list: disable object/refname
> > ambiguity check with --stdin".  While the get_object_list() method
> > reads the objects from stdin, turn warn_on_object_refname_ambiguity
> > flag (which is usually true) to false.  Just for code hygiene, save
> > away the original at the beginning and restore it once we are done.
> 
> I actually think this is a bit too broad.  The calling process of
> this program does know that it is feeding list of raw object names
> (prefixed with ^ for negative ones), but the codepath this patch
> touches does not know who is calling it with what.  It would be
> safer to introduce a mechanism for the caller to tell this codepath
> not to bother checking refnames, as it knows it is feeding the raw
> object names and not refnames.
> 
> After all, you can feed things like "refs/heads/master" from the
> standard input of "git pack-objects --revs", no?

Keep in mind that this is not disallowing "refs/heads/master", nor even
disabling the ambiguity checking if we feed a "foo" that exists as both
a tag and a branch.

It is only disabling the check that when the caller feeds a 40-hex sha1,
we do not double-check to make sure that there is not a ref of the same
name (which is not even really an ambiguity, but just an informational
message for the user; the object id has always and must always take
precedence).

So yes, the caller does know better "I am only going to feed object
ids". But you can likewise look from the callee's perspective: "I am
going to take a lot of inputs, and spending time for an informational
message for each one is not worth doing".

So I think it's justifiable from that point of view. And from a
practical point of view, it's much simpler: we do not have teach every
caller to specify its input, or risk being slowed down by a low-value
informational check.

-Peff

      reply	other threads:[~2018-11-07  9:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 19:13 [PATCH 0/1] send-pack: set core.warnAmbiguousRefs=false Derrick Stolee via GitGitGadget
2018-11-06 19:13 ` [PATCH 1/1] " Derrick Stolee via GitGitGadget
2018-11-06 19:44 ` [PATCH 0/1] " Jeff King
2018-11-06 19:51   ` Jeff King
2018-11-06 20:16     ` Derrick Stolee
2018-11-06 20:00   ` Derrick Stolee
2018-11-06 20:34 ` [PATCH v2 " Derrick Stolee via GitGitGadget
2018-11-06 20:34   ` [PATCH v2 1/1] pack-objects: ignore ambiguous object warnings Derrick Stolee via GitGitGadget
2018-11-06 21:12     ` Jeff King
2018-11-07  1:54       ` Junio C Hamano
2018-11-07  8:52         ` Junio C Hamano
2018-11-07  9:21           ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20181107092129.GA8671@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).