Unfortunately they do not work. Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- git-remote-testgit | 18 +++++++++++++---- t/t5801-remote-helpers.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) mode change 100755 => 100644 t/t5801-remote-helpers.sh diff --git a/git-remote-testgit b/git-remote-testgit index fe73c36..31c7533 100755 --- a/git-remote-testgit +++ b/git-remote-testgit @@ -6,24 +6,34 @@ url=$2 dir="$GIT_DIR/testgit/$alias" prefix="refs/testgit/$alias" -refspec="refs/heads/*:${prefix}/heads/*" + +default_refspec="refs/heads/*:${prefix}/heads/*" + +refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}" gitmarks="$dir/git.marks" testgitmarks="$dir/testgit.marks" +test -z "$refspec" && prefix="refs" + export GIT_DIR="$url/.git" mkdir -p "$dir" -test -e "$gitmarks" || > "$gitmarks" -test -e "$testgitmarks" || > "$testgitmarks" +if [ -z "$GIT_REMOTE_TESTGIT_NO_MARKS" ]; then + test -e "$gitmarks" || > "$gitmarks" + test -e "$testgitmarks" || > "$testgitmarks" +else + > "$gitmarks" + > "$testgitmarks" +fi while read line; do case $line in capabilities) echo 'import' echo 'export' - echo "refspec $refspec" + test -n "$refspec" && echo "refspec $refspec" echo "*import-marks $gitmarks" echo "*export-marks $gitmarks" echo diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh old mode 100755 new mode 100644 index bc0b5f7..31940c9 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@ -110,4 +110,53 @@ test_expect_failure 'push new branch with old:new refspec' ' compare_refs local HEAD server refs/heads/new-refspec ' +test_expect_failure 'cloning without refspec' ' + GIT_REMOTE_TESTGIT_REFSPEC="" \ + git clone "testgit::${PWD}/server" local2 && + compare_refs local2 HEAD server HEAD +' + +test_expect_failure 'pulling without refspecs' ' + (cd local2 && + git reset --hard && + GIT_REMOTE_TESTGIT_REFSPEC="" git pull) && + compare_refs local2 HEAD server HEAD +' + +test_expect_failure 'pushing without refspecs' ' + (cd local2 && + echo content >>file && + git commit -a -m three && + GIT_REMOTE_TESTGIT_REFSPEC="" git push) && + compare_refs local2 HEAD server HEAD +' + +test_expect_failure 'pulling with straight refspec' ' + (cd local2 && + GIT_REMOTE_TESTGIT_REFSPEC="*:*" git pull) && + compare_refs local2 HEAD server HEAD +' + +test_expect_failure 'pushing with straight refspec' ' + (cd local2 && + echo content >>file && + git commit -a -m three && + GIT_REMOTE_TESTGIT_REFSPEC="*:*" git push) && + compare_refs local2 HEAD server HEAD +' + +test_expect_failure 'pulling without marks' ' + (cd local2 && + GIT_REMOTE_TESTGIT_NO_MARKS=1 git pull) && + compare_refs local2 HEAD server HEAD +' + +test_expect_failure 'pushing without marks' ' + (cd local2 && + echo content >>file && + git commit -a -m three && + GIT_REMOTE_TESTGIT_NO_MARKS=1 git push) && + compare_refs local2 HEAD server HEAD +' + test_done -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html