git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t9400: Add some tests for checkout

From
Frank Lichtenheld <frank@lichtenheld.de>
Date
Oct 4, 2007, 18:13 UTC
Message-ID
<1191521625-2597-1-git-send-email-frank@lichtenheld.de>

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@lichtenheld.de>
---
 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
Next: Johannes Schindelin
Message 1 of 5 in “t9400: Add some tests for checkout”
  1. t9400: Add some tests for checkoutFrank Lichtenheld, Oct 4, 2007
  2. Johannes SchindelinOct 4, 2007
  3. Frank LichtenheldOct 4, 2007
  4. Johannes SchindelinOct 4, 2007
  5. Frank LichtenheldOct 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.