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

[PATCH 10/20] cvsserver status: provide real sticky info

From
MOMatthew Ogilvie <mmogilvi_git@miniinfo.net>
Date
Oct 14, 2012, 05:42 UTC
Message-ID
<1350193353-19210-11-git-send-email-mmogilvi_git@miniinfo.net>
In-Reply-To
<1350193353-19210-1-git-send-email-mmogilvi_git@miniinfo.net>
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
---
 git-cvsserver.perl            | 24 ++++++++++++++++++++----
 t/t9401-git-cvsserver-crlf.sh | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 4d514b4..c5ebfa0 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -502,7 +502,7 @@ sub req_Entry
 
     #$log->debug("req_Entry : $data");
 
-    my @data = split(/\//, $data);
+    my @data = split(/\//, $data, -1);
 
     $state->{entries}{$state->{directory}.$data[1]} = {
         revision    => $data[2],
@@ -1681,9 +1681,25 @@ sub req_status
             print "M Repository revision:\t" .
                    $meta->{revision} .
                    "\t$state->{CVSROOT}/$state->{module}/$filename,v\n";
-            print "M Sticky Tag:\t\t(none)\n";
-            print "M Sticky Date:\t\t(none)\n";
-            print "M Sticky Options:\t\t(none)\n";
+            my($tagOrDate)=$state->{entries}{$filename}{tag_or_date};
+            my($tag)=($tagOrDate=~m/^T(.+)$/);
+            if( !defined($tag) )
+            {
+                $tag="(none)";
+            }
+            print "M Sticky Tag:\t\t$tag\n";
+            my($date)=($tagOrDate=~m/^D(.+)$/);
+            if( !defined($date) )
+            {
+                $date="(none)";
+            }
+            print "M Sticky Date:\t\t$date\n";
+            my($options)=$state->{entries}{$filename}{options};
+            if( $options eq "" )
+            {
+                $options="(none)";
+            }
+            print "M Sticky Options:\t\t$options\n";
         } else {
             print "M Repository revision:\tNo revision control file\n";
         }
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index ff6d6fb..7c3c39e 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -38,6 +38,25 @@ not_present() {
     fi
 }
 
+check_status_options() {
+    (cd "$1" &&
+    GIT_CONFIG="$git_config" cvs -Q status "$2" > "${WORKDIR}/status.out" 2>&1
+    )
+    if [ x"$?" != x"0" ] ; then
+        echo "Error from cvs status: $1 $2" >> "${WORKDIR}/marked.log"
+        return 1;
+    fi
+    got="$(sed -n -e 's/^\s*Sticky Options:\s*//p' "${WORKDIR}/status.out")"
+    expect="$3"
+    if [ x"$expect" = x"" ] ; then
+        expect="(none)"
+    fi
+    test x"$got" = x"$expect"
+    stat=$?
+    echo "cvs status: $1 $2 $stat '$3' '$got'" >> "${WORKDIR}/marked.log"
+    return $stat
+}
+
 cvs >/dev/null 2>&1
 if test $? -ne 1
 then
@@ -233,6 +252,22 @@ test_expect_success 'cvs co another copy (guess)' '
     marked_as cvswork2/subdir newfile.c ""
 '
 
+test_expect_success 'cvs status - sticky options' '
+    check_status_options cvswork2 textfile.c "" &&
+    check_status_options cvswork2 binfile.bin -kb &&
+    check_status_options cvswork2 .gitattributes "" &&
+    check_status_options cvswork2 mixedUp.c -kb &&
+    check_status_options cvswork2 multiline.c -kb &&
+    check_status_options cvswork2 multilineTxt.c "" &&
+    check_status_options cvswork2/subdir withCr.bin -kb &&
+    check_status_options cvswork2 subdir/withCr.bin -kb &&
+    check_status_options cvswork2/subdir file.h "" &&
+    check_status_options cvswork2 subdir/file.h "" &&
+    check_status_options cvswork2/subdir unspecified.other "" &&
+    check_status_options cvswork2/subdir newfile.bin "" &&
+    check_status_options cvswork2/subdir newfile.c ""
+'
+
 test_expect_success 'add text (guess)' '
     (cd cvswork &&
     echo "simpleText" > simpleText.c &&
-- 
1.7.10.2.484.gcd07cc5
Previous: Matthew OgilvieNext: Matthew Ogilvie
Message 11 of 22 in “git-cvsserver: add support for cvs "-r" refs”
  1. 00/20 git-cvsserver: add support for cvs "-r" refsMatthew Ogilvie, Oct 14, 2012
  2. 01/20 cvsserver t9400: add basic 'cvs log' testMatthew Ogilvie, Oct 14, 2012
  3. 02/20 cvsserver: removed unused sha1Or-k mode from kopts_from_pathMatthew Ogilvie, Oct 14, 2012
  4. 03/20 cvsserver: add comments about database schema/usageMatthew Ogilvie, Oct 14, 2012
  5. 04/20 cvsserver update: comment about how we shouldn't remove a user-modified fileMatthew Ogilvie, Oct 14, 2012
  6. 05/20 cvsserver: remove unused functions _headrev and gethistoryMatthew Ogilvie, Oct 14, 2012
  7. 06/20 cvsserver: clean up client request handler map commentsMatthew Ogilvie, Oct 14, 2012
  8. 07/20 cvsserver: split up long lines in req_{status,diff,log}Matthew Ogilvie, Oct 14, 2012
  9. 08/20 cvsserver: use whole CVS rev number in-process; don't strip "1." prefixMatthew Ogilvie, Oct 14, 2012
  10. 09/20 cvsserver: cvs add: do not expand directory argumentsMatthew Ogilvie, Oct 14, 2012
  11. 10/20 cvsserver status: provide real sticky infoMatthew Ogilvie, Oct 14, 2012
  12. 11/20 cvsserver: factor out git-log parsing logicMatthew Ogilvie, Oct 14, 2012
  13. 12/20 cvsserver: cleanup extra slashes in filename argumentsMatthew Ogilvie, Oct 14, 2012
  14. 13/20 cvsserver: define a tag name character escape mechanismMatthew Ogilvie, Oct 14, 2012
  15. 14/20 cvsserver: add misc commit lookup, file meta data, and file listing functionsMatthew Ogilvie, Oct 14, 2012
  16. 15/20 cvsserver: implement req_Sticky and related utilitiesMatthew Ogilvie, Oct 14, 2012
  17. 16/20 cvsserver: generalize getmeta() to recognize commit refsMatthew Ogilvie, Oct 14, 2012
  18. 17/20 cvsserver: Add version awareness to argsfromdirMatthew Ogilvie, Oct 14, 2012
  19. 18/20 cvsserver: support -r and sticky tags for most operationsMatthew Ogilvie, Oct 14, 2012
  20. 19/20 cvsserver: add t9402 to test branch and tag refsMatthew Ogilvie, Oct 14, 2012
  21. 20/20 cvsserver Documentation: new cvs ... -r supportMatthew Ogilvie, Oct 14, 2012
  22. Junio C HamanoOct 16, 2012

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.