summaryrefslogtreecommitdiff
path: root/git-fetch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-11-23 05:57:14 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-11-24 00:54:54 (GMT)
commit28b8e61fc63b6776a91e8afd03c7171fbf0779b0 (patch)
tree6c83f17c49a29f8c10755eed696855bde7a4f769 /git-fetch.sh
parent4769489a412fb0decbd73ce59a6756985d0d6bc4 (diff)
downloadgit-28b8e61fc63b6776a91e8afd03c7171fbf0779b0.zip
git-28b8e61fc63b6776a91e8afd03c7171fbf0779b0.tar.gz
git-28b8e61fc63b6776a91e8afd03c7171fbf0779b0.tar.bz2
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>
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-xgit-fetch.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/git-fetch.sh b/git-fetch.sh
index eb32476..170c2cb 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -88,6 +88,10 @@ then
: >"$GIT_DIR/FETCH_HEAD"
fi
+# Global that is reused later
+ls_remote_result=$(git ls-remote $upload_pack "$remote") ||
+ die "Cannot find the reflist at $remote"
+
append_fetch_head () {
head_="$1"
remote_="$2"
@@ -233,10 +237,7 @@ reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags"
then
taglist=`IFS=" " &&
- (
- git-ls-remote $upload_pack --tags "$remote" ||
- echo fail ouch
- ) |
+ echo "$ls_remote_result" |
while read sha1 name
do
case "$sha1" in
@@ -245,6 +246,8 @@ then
esac
case "$name" in
*^*) continue ;;
+ refs/tags/*) ;;
+ *) continue ;;
esac
if git-check-ref-format "$name"
then
@@ -431,7 +434,7 @@ case "$no_tags$tags" in
# effective only when we are following remote branch
# using local tracking branch.
taglist=$(IFS=" " &&
- git-ls-remote $upload_pack --tags "$remote" |
+ echo "$ls_remote_result" |
sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \
-e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' |
while read sha1 name