summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-11-25 01:10:10 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-11-25 01:10:10 -0800
commitd945d4be20d577868646f1b676b605cd9fdadf86 (patch)
tree5a8fb0cad19599f252cf7195d073fa6b5a240764
parentMerge branch 'master' into jc/globfetch (diff)
downloadtgif-d945d4be20d577868646f1b676b605cd9fdadf86.tar.xz
git-fetch: allow forcing glob pattern in refspec
Building on top of the earlier refspec glob pattern enhancement, this allows a glob pattern to say the updates should be forced by prefixing it with '+' as usual, like this: Pull: +refs/heads/*:refs/remotes/origin/* Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgit-parse-remote.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index e281b7c6eb..19bc3857d1 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -99,13 +99,17 @@ get_remote_default_refs_for_push () {
expand_refs_wildcard () {
for ref
do
+ lref=${ref#'+'}
# a non glob pattern is given back as-is.
- expr "z$ref" : 'zrefs/.*/\*:refs/.*/\*$' >/dev/null || {
+ expr "z$lref" : 'zrefs/.*/\*:refs/.*/\*$' >/dev/null || {
echo "$ref"
continue
}
- from=`expr "z$ref" : 'z\(refs/.*/\)\*:refs/.*/\*$'`
- to=`expr "z$ref" : 'zrefs/.*/\*:\(refs/.*/\)\*$'`
+
+ 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" |
(
IFS=' '
@@ -117,7 +121,7 @@ expand_refs_wildcard () {
then
continue
fi
- echo "${name}:${to}${mapped}"
+ echo "${local_force}${name}:${to}${mapped}"
done
)
done