Skip to content

Commit

Permalink
git-fetch: reuse ls-remote result.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Nov 24, 2006
1 parent 4769489 commit 28b8e61
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions git-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -245,6 +246,8 @@ then
esac
case "$name" in
*^*) continue ;;
refs/tags/*) ;;
*) continue ;;
esac
if git-check-ref-format "$name"
then
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 28b8e61

Please sign in to comment.