bug-cvs
[Top][All Lists]
Advanced

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

cvs -d commit can miss some files


From: Simon Walton
Subject: cvs -d commit can miss some files
Date: Fri, 20 Sep 2002 17:39:37 -0700

   If the -d option is used with cvs commit to override CVS/Root,
then modified files in the directory that cvs is invoked
from may get missed by the commit.

   This is because the routine arg_should_not_be_sent_to_server()
in client.c is erroneously throwing out the filename
because CVS/Root does not match the server that it is
connected to.

   This patch fixes that by giving the command-line
cvs root priority over the value returned by Name_Root().
I'm not sure if this is the best way to fix it; perhaps
Name_Root() should be changed instead. This fix seemed
safer however.

Simon Walton
Index: ChangeLog
===================================================================
RCS file: /home/cvsroot/tools/cvs/ChangeLog,v
retrieving revision 1.7
diff -u -r1.7 ChangeLog
--- ChangeLog   2002/09/11 15:16:12     1.7
+++ ChangeLog   2002/09/21 00:23:54
@@ -1,3 +1,8 @@
+2002-09-20  Simon Walton  <address@hidden>
+
+       * Fix missed files in commit with -d global option
+       if -d value was different to working copy's.
+
 2002-09-11  Jim Meyering  <address@hidden>
 
        * (all auto*-generated files): Regenerate using automake-1.6 and
Index: src/client.c
===================================================================
RCS file: /home/cvsroot/tools/cvs/src/client.c,v
retrieving revision 1.11
diff -u -r1.11 client.c
--- src/client.c        2002/09/11 12:49:03     1.11
+++ src/client.c        2002/09/21 00:23:54
@@ -247,7 +247,8 @@
        {
            /* We're at the beginning of the string.  Look at the
                CVSADM files in cwd.  */
-           this_root = Name_Root ((char *) NULL, (char *) NULL);
+           this_root = CVSroot_cmdline ? xstrdup(CVSroot_cmdline) :
+               Name_Root ((char *) NULL, (char *) NULL);
        }
 
        /* Now check the value for root. */
Index: src/sanity.sh
===================================================================
RCS file: /home/cvsroot/tools/cvs/src/sanity.sh,v
retrieving revision 1.17
diff -u -r1.17 sanity.sh
--- src/sanity.sh       2002/09/17 19:45:49     1.17
+++ src/sanity.sh       2002/09/21 00:23:54
@@ -707,7 +707,7 @@
        # Multiple root directories and low-level protocol tests.
        tests="${tests} multiroot multiroot2 multiroot3 multiroot4"
        tests="${tests} rmroot reposmv pserver server server2 client"
-       tests="${tests} fork"
+       tests="${tests} fork commit-d"
 else
        tests="$*"
 fi
@@ -24331,6 +24331,31 @@
          cd ../..
          rm -rf 1
          rm -rf ${CVSROOT_DIRNAME}/$module
+         ;;
+
+       commit-d)
+         # Check that top-level commits work when CVS/Root
+         # is overridden by cvs -d.
+
+         mkdir -p 1/subdir; cd 1
+         touch file1 subdir/file2
+         dotest commit-d-1 "$testcvs -Q import -m. c-d-c X Y" ""
+         dotest commit-d-2 "$testcvs -Q co c-d-c" ""
+         cd c-d-c
+         echo change >>file1; echo another change >>subdir/file2
+         # Changing working root, then override with -d
+         echo nosuchhost:/cvs > CVS/Root
+         dotest commit-d-3 "$testcvs -Q -d $CVSROOT commit -m." \
+"Checking in file1;
+${TESTDIR}/cvsroot/c-d-c/file1,v  <--  file1
+new revision: 1.2; previous revision: 1.1
+done
+Checking in subdir/file2;
+${TESTDIR}/cvsroot/c-d-c/subdir/file2,v  <--  file2
+new revision: 1.2; previous revision: 1.1
+done"
+         cd ../..
+         rm -rf 1 cvsroot/c-d-c
          ;;
 
        *)
Index: src/version.c
===================================================================
RCS file: /home/cvsroot/tools/cvs/src/version.c,v
retrieving revision 1.26
diff -u -r1.26 version.c
--- src/version.c       2002/09/11 12:49:06     1.26
+++ src/version.c       2002/09/21 00:23:54
@@ -18,7 +18,8 @@
 char *config_string = " (client/server)\n"
   "   + loginfo-pipe patch\n"
   "   + update -p patch\n"
-  "   + commit-add-missing patch\n";
+  "   + commit-add-missing patch\n"
+  "   + cvs -d patch\n";
 
 #else
 char *config_string = " (client)\n";

reply via email to

[Prev in Thread] Current Thread [Next in Thread]