Unfortunately they do not work.

Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com>
---
 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 b9810fd..6c348b0 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" || echo -n > "$gitmarks"
-test -e "$testgitmarks" || echo -n > "$testgitmarks"
+if [ -z "$GIT_REMOTE_TESTGIT_NO_MARKS" ]; then
+    test -e "$gitmarks" || echo -n > "$gitmarks"
+    test -e "$testgitmarks" || echo -n > "$testgitmarks"
+else
+    echo -n > "$gitmarks"
+    echo -n > "$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 3c4e09a..83561f8
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -105,4 +105,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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to