summaryrefslogtreecommitdiff
path: root/git-parse-remote.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-16 21:43:28 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-02-14 05:43:53 (GMT)
commit86551586da8cba6c06ac04783a656843a4e47f35 (patch)
treefdc192784ed672835244a55220fb35869ec1b274 /git-parse-remote.sh
parentd1e0ef6cc89e5ef2f914c37719b9c2327e534834 (diff)
downloadgit-86551586da8cba6c06ac04783a656843a4e47f35.zip
git-86551586da8cba6c06ac04783a656843a4e47f35.tar.gz
git-86551586da8cba6c06ac04783a656843a4e47f35.tar.bz2
git-fetch: rewrite expand_ref_wildcard in C
This does not seem to make measurable improvement when dealing with 1000 unpacked refs, but we would need something like it if we were to do a full rewrite in C somedaoy. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-parse-remote.sh')
-rwxr-xr-xgit-parse-remote.sh46
1 files changed, 1 insertions, 45 deletions
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 5208ee6..9b19a21 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -81,51 +81,7 @@ get_remote_default_refs_for_push () {
# is to help prevent randomly "globbed" ref from being chosen as
# a merge candidate
expand_refs_wildcard () {
- remote="$1"
- shift
- first_one=yes
- if test "$#" = 0
- then
- echo empty
- echo >&2 "Nothing specified for fetching with remote.$remote.fetch"
- fi
- for ref
- do
- lref=${ref#'+'}
- # a non glob pattern is given back as-is.
- expr "z$lref" : 'zrefs/.*/\*:refs/.*/\*$' >/dev/null || {
- if test -n "$first_one"
- then
- echo "explicit"
- first_one=
- fi
- echo "$ref"
- continue
- }
-
- # glob
- if test -n "$first_one"
- then
- echo "glob"
- first_one=
- fi
- from=`expr "z$lref" : 'z\(refs/.*/\)\*:refs/.*/\*$'`
- to=`expr "z$lref" : 'zrefs/.*/\*:\(refs/.*/\)\*$'`
- local_force=
- test "z$lref" = "z$ref" || local_force='+'
- echo "$ls_remote_result" |
- sed -e '/\^{}$/d' |
- (
- IFS=' '
- while read sha1 name
- do
- # ignore the ones that do not start with $from
- mapped=${name#"$from"}
- test "z$name" = "z$mapped" && continue
- echo "${local_force}${name}:${to}${mapped}"
- done
- )
- done
+ git fetch--tool expand-refs-wildcard "$ls_remote_result" "$@"
}
# Subroutine to canonicalize remote:local notation.