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>
This commit is contained in:
parent
4769489a41
commit
28b8e61fc6
13
git-fetch.sh
13
git-fetch.sh
@ -88,6 +88,10 @@ then
|
|||||||
: >"$GIT_DIR/FETCH_HEAD"
|
: >"$GIT_DIR/FETCH_HEAD"
|
||||||
fi
|
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 () {
|
append_fetch_head () {
|
||||||
head_="$1"
|
head_="$1"
|
||||||
remote_="$2"
|
remote_="$2"
|
||||||
@ -233,10 +237,7 @@ reflist=$(get_remote_refs_for_fetch "$@")
|
|||||||
if test "$tags"
|
if test "$tags"
|
||||||
then
|
then
|
||||||
taglist=`IFS=" " &&
|
taglist=`IFS=" " &&
|
||||||
(
|
echo "$ls_remote_result" |
|
||||||
git-ls-remote $upload_pack --tags "$remote" ||
|
|
||||||
echo fail ouch
|
|
||||||
) |
|
|
||||||
while read sha1 name
|
while read sha1 name
|
||||||
do
|
do
|
||||||
case "$sha1" in
|
case "$sha1" in
|
||||||
@ -245,6 +246,8 @@ then
|
|||||||
esac
|
esac
|
||||||
case "$name" in
|
case "$name" in
|
||||||
*^*) continue ;;
|
*^*) continue ;;
|
||||||
|
refs/tags/*) ;;
|
||||||
|
*) continue ;;
|
||||||
esac
|
esac
|
||||||
if git-check-ref-format "$name"
|
if git-check-ref-format "$name"
|
||||||
then
|
then
|
||||||
@ -431,7 +434,7 @@ case "$no_tags$tags" in
|
|||||||
# effective only when we are following remote branch
|
# effective only when we are following remote branch
|
||||||
# using local tracking branch.
|
# using local tracking branch.
|
||||||
taglist=$(IFS=" " &&
|
taglist=$(IFS=" " &&
|
||||||
git-ls-remote $upload_pack --tags "$remote" |
|
echo "$ls_remote_result" |
|
||||||
sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \
|
sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \
|
||||||
-e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' |
|
-e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' |
|
||||||
while read sha1 name
|
while read sha1 name
|
||||||
|
Loading…
Reference in New Issue
Block a user