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

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

From
Johannes Sixt <j.sixt@eudaptics.com>
Date
Apr 17, 2007, 16:10 UTC
Message-ID
<4624F183.D4B6BBB1@eudaptics.com>

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

Is this considered in the shell-to-C rewrite that's currently going on?

The background is that I sometimes fetch a branch with tags, but then
decide to remove it (and the tags as well). git-gc and git-prune do not
guarantee that the objects go away because they could be reachable from
reflogs. Now the next git-fetch will fetch the tags again even though I
do not have any refs from which they would be reachable.

-- Hannes
Next: Junio C Hamano
Message 1 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.