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

Re: git-fetch and unannotated tags

From
Junio C Hamano <junkio@cox.net>
Date
Apr 25, 2007, 21:00 UTC
Message-ID
<7vfy6ow4my.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200704252142.33756.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
>> You could even modify git-tag to create them for you with some
>> appropriate switch ...
>
> Well yes, but that's the answer to everything isn't it?

The answer to everything you want to change the current behaviour is to code something that implement that change. What else is new?

I suspect that if you look at what git-fetch.sh does in the paragraph that follows /^# automated tag following/, it probably is not that much change. At that point,

 (1) $ls_remote_result contains the output from "git ls-remote $URL"
     we ran earlier, LF and everything intact.
 (2) show-ref --exclude-existing=refs/tags/ discards, out of
     $ls_remote_result, everything that does not begin with refs/tags/,
     and at the same time, discards the ones you already have.
     This is done after stripping away ^{} markers.
 (3) The remainder is fed to the while loop, which says "if we
     already have the object pointed at by a surviving ref under
     refs/tags/ in the remote, follow that tag".

So I think you could filter out the ones that do not have corresponding ^{} in $ls_remote_result from the while loop. As the use of "show-ref --exclude-existing" is to speed things up by reducing the work done in the while loop written in shell, I would suggest giving another option to show-ref that can be used together with --exclude-existing.

Take a look at exclude_existing() function in builtin-show-ref.c; your additional option to the command would say something like:

  - ignore everything that do not begin with match (as we do now
    already);
  - if we do not have the ref we read from the stdin (determined
    with the call to path_list_has_path() there), instead of
    running printf() unconditionally as we do now, make sure we
    have both refs/tags/foo and refs/tags/foo^{} in the input.
    And show only those.
Previous: Andy ParkinsNext: Andy Parkins
Message 4 of 24 in “git-fetch and unannotated tags”
  1. Andy ParkinsApr 25, 2007
  2. Julian PhillipsApr 25, 2007
  3. Andy ParkinsApr 25, 2007
  4. Junio C HamanoApr 25, 2007
  5. Andy ParkinsApr 26, 2007
  6. Andreas EricssonApr 26, 2007
  7. Jakub NarebskiApr 27, 2007
  8. Junio C HamanoApr 29, 2007
  9. 0/2 bookmarks (was: Re: git-fetch and unannotated tags)Julian Phillips, Apr 25, 2007
  10. 1/2 refs.c: change do_one_ref to not discard any of baseJulian Phillips, Apr 25, 2007
  11. 2/2 Add basic support for bookmarks (create/edit/delete/list)Julian Phillips, Apr 25, 2007
  12. A Large Angry SCMApr 26, 2007
  13. Jeffrey C. OllieApr 26, 2007
  14. Junio C HamanoApr 26, 2007
  15. Julian PhillipsApr 26, 2007
  16. Junio C HamanoApr 26, 2007
  17. Julian PhillipsApr 26, 2007
  18. Andy ParkinsApr 26, 2007
  19. Andy ParkinsApr 26, 2007
  20. Petr BaudisApr 26, 2007
  21. Andy ParkinsApr 26, 2007
  22. Julian PhillipsApr 26, 2007
  23. Karl HasselströmApr 26, 2007
  24. Linus TorvaldsApr 26, 2007

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.