diff options
author | Junio C Hamano <junkio@cox.net> | 2006-12-17 17:57:19 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-17 17:57:19 -0800 |
commit | ed9f7c954c26ec6d517bdca3d8e4b895278d1b2b (patch) | |
tree | 4bb8f0ddd83046127d3e984665329f17e0a8dafc /git-fetch.sh | |
parent | ee6002aa429272871733b8fbc99a9e6df3e150f5 (diff) | |
download | git-ed9f7c954c26ec6d517bdca3d8e4b895278d1b2b.tar.gz |
git-fetch: Avoid reading packed refs over and over again
When checking which tags to fetch, the old code used to call
git-show-ref --verify for each remote tag. Since reading even
packed refs is not a cheap operation when there are a lot of
local refs, the code became quite slow.
This fixes it by teaching git-show-ref to filter out existing
refs using a new mode of operation of git-show-ref.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-x | git-fetch.sh | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/git-fetch.sh b/git-fetch.sh index fb35815a5f..38101a6ace 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -242,7 +242,7 @@ esac reflist=$(get_remote_refs_for_fetch "$@") if test "$tags" then - taglist=`IFS=" " && + taglist=`IFS=' ' && echo "$ls_remote_result" | while read sha1 name do @@ -438,17 +438,11 @@ case "$no_tags$tags" in *:refs/*) # effective only when we are following remote branch # using local tracking branch. - taglist=$(IFS=" " && + taglist=$(IFS=' ' && echo "$ls_remote_result" | - sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \ - -e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' | + git-show-ref --exclude-existing=refs/tags/ | while read sha1 name do - git-show-ref --verify --quiet -- "$name" && continue - git-check-ref-format "$name" || { - echo >&2 "warning: tag ${name} ignored" - continue - } git-cat-file -t "$sha1" >/dev/null 2>&1 || continue echo >&2 "Auto-following $name" echo ".${name}:${name}" |