[PATCH] t9400: Add some tests for checkout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Test the behaviour for non-branches (e.g. head) and
non-existant branches. Also make a test checkout with
packed refs.

Signed-off-by: Frank Lichtenheld <frank@xxxxxxxxxxxxxx>
---
 t/t9400-git-cvsserver-server.sh |   48 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 641303e..11def84 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -246,11 +246,50 @@ test_expect_success 'gitcvs.ext.dbname' \
    test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" &&
    cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"'
 
+# clean up
+rm -fr cvswork2
+rm -fr "$SERVERDIR"
+cd "$WORKDIR" &&
+git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
+GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
+GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
+exit 1
 
-#------------
-# CVS UPDATE
-#------------
+#--------------
+# CVS CHECKOUT
+#--------------
+test_expect_success 'cvs checkout failure (HEAD)' \
+  'if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 HEAD >cvs.log 2>&1
+   then
+     echo unexpected cvs success
+     false
+   else
+     true
+   fi &&
+   cat cvs.log | grep -q "not a branch" &&
+   test ! -d cvswork2'
+rm -fr cvswork2
 
+test_expect_success 'cvs checkout failure (foobar)' \
+  'if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 foobar >cvs.log 2>&1
+   then
+     echo unexpected cvs success
+     false
+   else
+     true
+   fi &&
+   cat cvs.log | grep -q "not a branch" &&
+   test ! -d cvswork2'
+rm -fr cvswork2
+
+test_expect_success 'cvs checkout (packed ref)' \
+  'GIT_DIR="$SERVERDIR" git-gc &&
+   test ! -f "$SERVERDIR/refs/heads/master" &&
+   GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
+   diff -qr cvswork cvswork2'
+
+# clean up
+rm -fr cvswork2
 rm -fr "$SERVERDIR"
 cd "$WORKDIR" &&
 git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
@@ -258,6 +297,9 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
 GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
 exit 1
 
+#------------
+# CVS UPDATE
+#------------
 test_expect_success 'cvs update (create new file)' \
   'echo testfile1 >testfile1 &&
    git add testfile1 &&
-- 
1.5.3.3

-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux