diff options
Diffstat (limited to 'git-remote-testgit.sh')
-rwxr-xr-x | git-remote-testgit.sh | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/git-remote-testgit.sh b/git-remote-testgit.sh index 6d2f282d32..752c763eb6 100755 --- a/git-remote-testgit.sh +++ b/git-remote-testgit.sh @@ -1,7 +1,13 @@ #!/bin/sh # Copyright (c) 2012 Felipe Contreras -alias=$1 +# The first argument can be a url when the fetch/push command was a url +# instead of a configured remote. In this case, use a generic alias. +if test "$1" = "testgit::$2"; then + alias=_ +else + alias=$1 +fi url=$2 dir="$GIT_DIR/testgit/$alias" @@ -13,7 +19,10 @@ refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}" test -z "$refspec" && prefix="refs" -export GIT_DIR="$url/.git" +GIT_DIR="$url/.git" +export GIT_DIR + +force= mkdir -p "$dir" @@ -39,6 +48,7 @@ do fi test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags" test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update" + echo 'option' echo ;; list) @@ -93,6 +103,7 @@ do before=$(git for-each-ref --format=' %(refname) %(objectname) ') git fast-import \ + ${force:+--force} \ ${testgitmarks:+"--import-marks=$testgitmarks"} \ ${testgitmarks:+"--export-marks=$testgitmarks"} \ --quiet @@ -115,6 +126,20 @@ do echo ;; + option\ *) + read cmd opt val <<-EOF + $line + EOF + case $opt in + force) + test $val = "true" && force="true" || force= + echo "ok" + ;; + *) + echo "unsupported" + ;; + esac + ;; '') exit ;; |