summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 437b1b2)
raw | patch | inline | side by side (parent: 437b1b2)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 16 Jan 2007 06:56:34 +0000 (22:56 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 14 Feb 2007 05:43:52 +0000 (21:43 -0800) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-fetch.sh | patch | blob | history |
diff --git a/git-fetch.sh b/git-fetch.sh
index ca984e739a595131dca4070982f524d3a53f9637..3e01265160464966e42d0f27c0283b7ffbbb6b0e 100755 (executable)
--- a/git-fetch.sh
+++ b/git-fetch.sh
fi
fi
-fetch_main () {
+fetch_native () {
+ reflist="$1"
+ refs=
+ rref=
+
+ for ref in $reflist
+ do
+ refs="$refs$LF$ref"
+
+ # These are relative path from $GIT_DIR, typically starting at refs/
+ # but may be HEAD
+ if expr "z$ref" : 'z\.' >/dev/null
+ then
+ not_for_merge=t
+ ref=$(expr "z$ref" : 'z\.\(.*\)')
+ else
+ not_for_merge=
+ fi
+ if expr "z$ref" : 'z+' >/dev/null
+ then
+ single_force=t
+ ref=$(expr "z$ref" : 'z+\(.*\)')
+ else
+ single_force=
+ fi
+ remote_name=$(expr "z$ref" : 'z\([^:]*\):')
+ local_name=$(expr "z$ref" : 'z[^:]*:\(.*\)')
+
+ rref="$rref$LF$remote_name"
+ done
+
+ ( : subshell because we muck with IFS
+ IFS=" $LF"
+ (
+ git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref ||
+ echo failed "$remote"
+ ) |
+ (
+ trap '
+ if test -n "$keepfile" && test -f "$keepfile"
+ then
+ rm -f "$keepfile"
+ fi
+ ' 0
+
+ keepfile=
+ while read sha1 remote_name
+ do
+ case "$sha1" in
+ failed)
+ echo >&2 "Fetch failure: $remote"
+ exit 1 ;;
+ # special line coming from index-pack with the pack name
+ pack)
+ continue ;;
+ keep)
+ keepfile="$GIT_OBJECT_DIRECTORY/pack/pack-$remote_name.keep"
+ continue ;;
+ esac
+ found=
+ single_force=
+ for ref in $refs
+ do
+ case "$ref" in
+ +$remote_name:*)
+ single_force=t
+ not_for_merge=
+ found="$ref"
+ break ;;
+ .+$remote_name:*)
+ single_force=t
+ not_for_merge=t
+ found="$ref"
+ break ;;
+ .$remote_name:*)
+ not_for_merge=t
+ found="$ref"
+ break ;;
+ $remote_name:*)
+ not_for_merge=
+ found="$ref"
+ break ;;
+ esac
+ done
+ local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
+ append_fetch_head "$sha1" "$remote" \
+ "$remote_name" "$remote_nick" "$local_name" \
+ "$not_for_merge" || exit
+ done
+ )
+ ) || exit
+
+}
+
+fetch_dumb () {
reflist="$1"
refs=
rref=
rsync_slurped_objects=t
}
;;
- *)
- # We will do git native transport with just one call later.
- continue ;;
esac
append_fetch_head "$head" "$remote" \
done
- case "$remote" in
- http://* | https://* | ftp://* | rsync://* )
- ;; # we are already done.
- *)
- ( : subshell because we muck with IFS
- IFS=" $LF"
- (
- git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref ||
- echo failed "$remote"
- ) |
- (
- trap '
- if test -n "$keepfile" && test -f "$keepfile"
- then
- rm -f "$keepfile"
- fi
- ' 0
-
- keepfile=
- while read sha1 remote_name
- do
- case "$sha1" in
- failed)
- echo >&2 "Fetch failure: $remote"
- exit 1 ;;
- # special line coming from index-pack with the pack name
- pack)
- continue ;;
- keep)
- keepfile="$GIT_OBJECT_DIRECTORY/pack/pack-$remote_name.keep"
- continue ;;
- esac
- found=
- single_force=
- for ref in $refs
- do
- case "$ref" in
- +$remote_name:*)
- single_force=t
- not_for_merge=
- found="$ref"
- break ;;
- .+$remote_name:*)
- single_force=t
- not_for_merge=t
- found="$ref"
- break ;;
- .$remote_name:*)
- not_for_merge=t
- found="$ref"
- break ;;
- $remote_name:*)
- not_for_merge=
- found="$ref"
- break ;;
- esac
- done
- local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
- append_fetch_head "$sha1" "$remote" \
- "$remote_name" "$remote_nick" "$local_name" \
- "$not_for_merge" || exit
- done
- )
- ) || exit ;;
- esac
+}
+fetch_main () {
+ case "$remote" in
+ http://* | https://* | ftp://* | rsync://* )
+ fetch_dumb "$@"
+ ;;
+ *)
+ fetch_native "$@"
+ ;;
+ esac
}
fetch_main "$reflist" || exit