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

Re: fetch: Auto-following tags should check connectivity, not existence

From
Junio C Hamano <junkio@cox.net>
Date
Apr 20, 2007, 06:39 UTC
Message-ID
<7v4pnb4kil.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<4624F183.D4B6BBB1@eudaptics.com>
Johannes Sixt <J.Sixt@eudaptics.com> writes:
Show 23 quoted lines
> git-fetch's auto-following of tags fetches all tags for which it finds
> objects in the local repository. I feel it were better if not object
> existence, but connectivity to the existing refs was checked, like this:
>
> diff --git a/git-fetch.sh b/git-fetch.sh
> index fd70696..1b3c459 100755
> --- a/git-fetch.sh
> +++ b/git-fetch.sh
> @@ -314,11 +314,12 @@ case "$no_tags$tags" in
>         taglist=$(IFS=' ' &&
>         echo "$ls_remote_result" |
>         git-show-ref --exclude-existing=refs/tags/ |
>         while read sha1 name
>         do
> -           git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
> +           t=$(git-rev-list --max-count=1 "$sha1" --not --all 2>
> /dev/null) &&
> +           test -z "$t" || continue
>             echo >&2 "Auto-following $name"
>             echo ".${name}:${name}"
>         done)
>     esac
>     case "$taglist" in

I think "something like this" is a sensible thing to do, on top of the updates to "rev-list --objects" to verify the blob we list actually exists.

However, I think --max-count=1 defeats what you are trying to do. Revision limiting will only look at commits, and if you have all commits that lead to the "$sha1" commit from some of the existing refs, but lack some blobs or trees that belong to some of the commits that are not the first commit that will be listed, their absense will not be noticed.

Previous: Johannes SixtNext: Junio C Hamano
Message 2 of 3 in “fetch: Auto-following tags should check connectivity, not existence”
  1. Johannes SixtApr 17, 2007
  2. Junio C HamanoApr 20, 2007
  3. Junio C HamanoApr 20, 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.