git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] for-each-ref: `:short` format for `refname`

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Sep 3, 2008, 08:33 UTC
Message-ID
<36ca99e90809030133r43fc5a3agad1aa38339a758a3@mail.gmail.com>
In-Reply-To
<7v63pei1pz.fsf@gitster.siamese.dyndns.org>
On Wed, Sep 3, 2008 at 01:10, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Bert Wesarg <bert.wesarg@googlemail.com> writes:
>
>> Tries to shorten the refname to a non-ambiguous name.
>> I.e. the full and the short refname points to the same object.
>
> The definition of "ambiguity" here is wrong (see below).
>
>> +              * by checking all rules in forward direction
>> +              */
>
> I think this part of the code is wrong, in that it talks about what object
> the ref points at.  That is not what ref ambiguity is about.
>
> Given a tag that points at a version 1.0.0 commit, this sequence will
> create:
>
>        $ git tag foo v1.0.0^0
>        $ git branch foo v1.0.0^0
>
> ambiguous branch and tag whose names are both 'foo', even though they
> point at the same thing.  The right API to use would be resolve_ref(), I
> think.
I use resolve_ref():
int read_ref(const char *ref, unsigned char *sha1)
{
	if (resolve_ref(ref, sha1, 1, NULL))
		return 0;
	return -1;
}

Ok, I think I get your point: it doesn't matter if the full and short point to different objects, it's enough for ambiguity that the short name resolves to more than one ref.

New patch in reply.
Show 8 quoted lines
>
> Other than that, it is well done.
>
> Although I was initially a bit surprised by the size of the patch to
> implement something so (conceptually) simple, the code was easy and
> straightforward to follow.
>
> Thanks.
Your welcome.
Bert
>
Previous: Junio C HamanoNext: Bert Wesarg
Message 13 of 26 in “for-each-ref: `:short` format for `refname`”
  1. for-each-ref: `:short` format for `refname`Bert Wesarg, Aug 31, 2008
  2. SZEDER GáborSep 1, 2008
  3. Bert WesargSep 1, 2008
  4. Bert WesargSep 1, 2008
  5. Shawn O. PearceSep 1, 2008
  6. Bert WesargSep 1, 2008
  7. Junio C HamanoSep 1, 2008
  8. Bert WesargSep 1, 2008
  9. Bert WesargSep 2, 2008
  10. Shawn O. PearceSep 2, 2008
  11. for-each-ref: `:short` format for `refname`Bert Wesarg, Sep 2, 2008
  12. Junio C HamanoSep 2, 2008
  13. Bert WesargSep 3, 2008
  14. for-each-ref: `:short` format for `refname`Bert Wesarg, Sep 3, 2008
  15. Shawn O. PearceSep 3, 2008
  16. Bert WesargSep 3, 2008
  17. Bert WesargSep 3, 2008
  18. Junio C HamanoSep 3, 2008
  19. for-each-ref: `:short` format for `refname`Bert Wesarg, Sep 5, 2008
  20. Junio C HamanoSep 5, 2008
  21. Bert WesargSep 6, 2008
  22. Junio C HamanoSep 8, 2008
  23. Shawn O. PearceSep 8, 2008
  24. Bert WesargSep 9, 2008
  25. Junio C HamanoSep 9, 2008
  26. Bert WesargSep 9, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.