@matheusbsbs / matheus-bagliano / commits / 28b8e61fc6
Fork 0

git-fetch: reuse ls-remote result.

This will become necessary to update the dumb protocol transports to fetch from a repository with packed and then pruned tags. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Nov 22, 2006 at 21:57 UTC 28b8e61fc63b6776a91e8afd03c7171fbf0779b0
1 file changed +8 -5
git-fetch.sh
+8 -5
@@ -88,6 +88,10 @@ then
88 : >"$GIT_DIR/FETCH_HEAD"
89 fi
90
91 +# Global that is reused later
92 +ls_remote_result=$(git ls-remote $upload_pack "$remote") ||
93 + die "Cannot find the reflist at $remote"
94 +
95 append_fetch_head () {
96 head_="$1"
97 remote_="$2"
@@ -233,10 +237,7 @@ reflist=$(get_remote_refs_for_fetch "$@")
237 if test "$tags"
238 then
239 taglist=`IFS=" " &&
236 - (
237 - git-ls-remote $upload_pack --tags "$remote" ||
238 - echo fail ouch
239 - ) |
240 + echo "$ls_remote_result" |
241 while read sha1 name
242 do
243 case "$sha1" in
@@ -245,6 +246,8 @@ then
246 esac
247 case "$name" in
248 *^*) continue ;;
249 + refs/tags/*) ;;
250 + *) continue ;;
251 esac
252 if git-check-ref-format "$name"
253 then
@@ -431,7 +434,7 @@ case "$no_tags$tags" in
434 # effective only when we are following remote branch
435 # using local tracking branch.
436 taglist=$(IFS=" " &&
434 - git-ls-remote $upload_pack --tags "$remote" |
437 + echo "$ls_remote_result" |
438 sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \
439 -e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' |
440 while read sha1 name