git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	git@vger.kernel.org
Subject: Re: [PATCH] remote.c: use shorten_unambiguous_ref
Date: Tue, 14 Apr 2009 20:18:45 +0200	[thread overview]
Message-ID: <36ca99e90904141118w425a059v6bd22a7e6400f78f@mail.gmail.com> (raw)
In-Reply-To: <7vprff41lf.fsf@gitster.siamese.dyndns.org>

On Tue, Apr 14, 2009 at 18:55, Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
>
>> Hmm. I was thinking we might be able to just do away with prettify_ref,
>> but I didn't consider the fact that we need to prettify remote things. I
>> think you could still unambiguously prettify the local half of those
>> callsites, though.
>>
>> Given that the two functions are closely related, should we perhaps
>> rename them to
>>
>>   const char *shorten_ref(const char *);
>>   const char *shorten_ref_unambiguous(const char *);
>>
>> ? The implementations are quite different, with prettify_ref not really
>> respecting the ref lookup rules, but rather just considering a few
>> pre-determined bits of the hierarchy as uninteresting. It shouldn't be
>> that hard to have them both use the same implementation, like:
>>
>>   const char *shorten_ref(const char *, int unambiguous);
>
> I was hoping that a single "shorten" function that does not even take
> "unambiguous" parameter would be used by almost everybody.  As far as I
> can see, Bert's "rev-parse --abbrev-ref" RFC is the only caller that might
> need to use a value different from warn_ambiguous_refs, and all the other
> existing callers (including fill_tracking_info() for "upstream" report by
> git-branch) do not have to pass "0" but can use the default.  IOW, we can
> have:
>
>        const char *shorten_ref_unambiguous(const char *ref, int strict);
>        const char *shorten_ref(const char *ref)
>        {
>                return shorten_ref_unambiguous(ref, warn_ambiguous_refs);
>        }
There's too much confusion: Whatever input you gave to
shorten_unambiguous_ref(), if you pass the result to dwim_ref() you
get the input again. That is, all return values are unambiguous. The
only small different (and here comes a little word-confusion) is, that
in strict mode you wont get any warning for 'ambiguous' refs. So the
names "shorten_ref_unambiguous" and "shorten_rer" are misleading,
because it looks like the former returns unambiguous refs and the
latter not. Which is wrong.

I can't think about this further, no time sorry.

Bert

  reply	other threads:[~2009-04-14 18:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09 15:33 [PATCH] remote.c: use shorten_unambiguous_ref Michael J Gruber
2009-04-10 17:14 ` Jeff King
2009-04-14 12:55   ` Michael J Gruber
2009-04-15  8:03     ` Jeff King
2009-04-14 16:55   ` Junio C Hamano
2009-04-14 18:18     ` Bert Wesarg [this message]
2009-04-15  8:12     ` Jeff King

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=36ca99e90904141118w425a059v6bd22a7e6400f78f@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).