cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src cvs.h add.c admin.c checkout.c client.... [signed-com


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src cvs.h add.c admin.c checkout.c client.... [signed-commits3]
Date: Thu, 12 Jan 2006 18:20:33 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         signed-commits3
Changes by:     Derek Robert Price <address@hidden>     06/01/12 18:20:32

Modified files:
        src            : cvs.h add.c admin.c checkout.c client.c 
                         commit.c edit.c fileattr.c history.c logmsg.c 
                         rcs.c server.c tag.c update.c create_adm.c 
                         repos.c ChangeLog 
Added files:
        src            : repos.h 

Log message:
        * cvs.h: Move some protos into...
        * repos.h: ...this new file.
        * add.c, admin.c, checkout.c, client.c, commit.c, edit.c, fileattr.c,
        history.c, logmsg.c, rcs.c, server.c, tag.c, update.c: #include
        "repos.h".
        * create_adm.c, repos.c: Ditto, and use stricter include formatting.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/cvs.h.diff?only_with_tag=signed-commits3&tr1=1.345.4.4&tr2=1.345.4.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/repos.h?only_with_tag=signed-commits3&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/add.c.diff?only_with_tag=signed-commits3&tr1=1.121.6.4&tr2=1.121.6.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/admin.c.diff?only_with_tag=signed-commits3&tr1=1.111.2.4&tr2=1.111.2.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/checkout.c.diff?only_with_tag=signed-commits3&tr1=1.145.2.3&tr2=1.145.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/client.c.diff?only_with_tag=signed-commits3&tr1=1.438.2.8&tr2=1.438.2.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/commit.c.diff?only_with_tag=signed-commits3&tr1=1.257.2.4&tr2=1.257.2.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/edit.c.diff?only_with_tag=signed-commits3&tr1=1.90.2.3&tr2=1.90.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/fileattr.c.diff?only_with_tag=signed-commits3&tr1=1.36.8.2&tr2=1.36.8.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/history.c.diff?only_with_tag=signed-commits3&tr1=1.95.6.2&tr2=1.95.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/logmsg.c.diff?only_with_tag=signed-commits3&tr1=1.99.6.2&tr2=1.99.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.c.diff?only_with_tag=signed-commits3&tr1=1.356.6.6&tr2=1.356.6.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/server.c.diff?only_with_tag=signed-commits3&tr1=1.453.2.6&tr2=1.453.2.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/tag.c.diff?only_with_tag=signed-commits3&tr1=1.142.6.3&tr2=1.142.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/update.c.diff?only_with_tag=signed-commits3&tr1=1.259.2.4&tr2=1.259.2.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/create_adm.c.diff?only_with_tag=signed-commits3&tr1=1.52&tr2=1.52.8.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/repos.c.diff?only_with_tag=signed-commits3&tr1=1.41&tr2=1.41.6.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?only_with_tag=signed-commits3&tr1=1.3328.2.24&tr2=1.3328.2.25&r1=text&r2=text

Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3328.2.24 ccvs/src/ChangeLog:1.3328.2.25
--- ccvs/src/ChangeLog:1.3328.2.24      Thu Jan 12 03:15:23 2006
+++ ccvs/src/ChangeLog  Thu Jan 12 18:20:32 2006
@@ -1,3 +1,12 @@
+2006-01-12  Derek Price  <address@hidden>
+
+       * cvs.h: Move some protos into...
+       * repos.h: ...this new file.
+       * add.c, admin.c, checkout.c, client.c, commit.c, edit.c, fileattr.c,
+       history.c, logmsg.c, rcs.c, server.c, tag.c, update.c: #include
+       "repos.h".
+       * create_adm.c, repos.c: Ditto, and use stricter include formatting.
+
 2006-01-11  Derek Price  <address@hidden>
 
        * main.c (opt_usage): Clarify --verify usage.
Index: ccvs/src/add.c
diff -u ccvs/src/add.c:1.121.6.4 ccvs/src/add.c:1.121.6.5
--- ccvs/src/add.c:1.121.6.4    Tue Jan 10 18:42:38 2006
+++ ccvs/src/add.c      Thu Jan 12 18:20:31 2006
@@ -43,6 +43,7 @@
 #include "fileattr.h"
 #include "ignore.h"
 #include "logmsg.h"
+#include "repos.h"
 #include "wrapper.h"
 
 #include "cvs.h"
Index: ccvs/src/admin.c
diff -u ccvs/src/admin.c:1.111.2.4 ccvs/src/admin.c:1.111.2.5
--- ccvs/src/admin.c:1.111.2.4  Wed Jan 11 04:37:08 2006
+++ ccvs/src/admin.c    Thu Jan 12 18:20:31 2006
@@ -26,6 +26,7 @@
 /* CVS headers.  */
 #include "ignore.h"
 #include "recurse.h"
+#include "repos.h"
 #include "wrapper.h"
 
 #include "cvs.h"
Index: ccvs/src/checkout.c
diff -u ccvs/src/checkout.c:1.145.2.3 ccvs/src/checkout.c:1.145.2.4
--- ccvs/src/checkout.c:1.145.2.3       Tue Jan 10 18:42:38 2006
+++ ccvs/src/checkout.c Thu Jan 12 18:20:31 2006
@@ -45,6 +45,7 @@
 /* CVS headers.  */
 #include "ignore.h"
 #include "recurse.h"
+#include "repos.h"
 #include "wrapper.h"
 
 #include "cvs.h"
Index: ccvs/src/client.c
diff -u ccvs/src/client.c:1.438.2.8 ccvs/src/client.c:1.438.2.9
--- ccvs/src/client.c:1.438.2.8 Wed Jan 11 04:37:08 2006
+++ ccvs/src/client.c   Thu Jan 12 18:20:31 2006
@@ -35,6 +35,7 @@
 #include "edit.h"
 #include "ignore.h"
 #include "recurse.h"
+#include "repos.h"
 #include "wrapper.h"
 
 #include "cvs.h"
Index: ccvs/src/commit.c
diff -u ccvs/src/commit.c:1.257.2.4 ccvs/src/commit.c:1.257.2.5
--- ccvs/src/commit.c:1.257.2.4 Tue Jan 10 18:42:38 2006
+++ ccvs/src/commit.c   Thu Jan 12 18:20:31 2006
@@ -32,6 +32,7 @@
 #include "ignore.h"
 #include "logmsg.h"
 #include "recurse.h"
+#include "repos.h"
 #include "wrapper.h"
 
 #include "cvs.h"
Index: ccvs/src/create_adm.c
diff -u /dev/null ccvs/src/create_adm.c:1.52.8.1
--- /dev/null   Thu Jan 12 18:20:33 2006
+++ ccvs/src/create_adm.c       Thu Jan 12 18:20:32 2006
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 1986-2006 The Free Software Foundation, Inc.
+ *
+ * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
+ *                                  and others.
+ *
+ * Portions Copyright (C) 1992, Brian Berliner and Jeff Polk
+ * Portions Copyright (C) 1989-1992, Brian Berliner
+ * 
+ * You may distribute under the terms of the GNU General Public License as
+ * specified in the README file that comes with the CVS source distribution.
+ * 
+ * Create Administration.
+ * 
+ * Creates a CVS administration directory based on the argument repository; the
+ * "Entries" file is prefilled from the "initrecord" argument.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* CVS Headers.  */
+#include "repos.h"
+
+#include "cvs.h"
+
+
+
+/* update_dir includes dir as its last component.
+
+   Return value is 0 for success, or 1 if we printed a warning message.
+   Note that many errors are still fatal; particularly for unlikely errors
+   a fatal error is probably better than a warning which might be missed
+   or after which CVS might do something non-useful.  If WARN is zero, then
+   don't print warnings; all errors are fatal then.  */
+
+int
+Create_Admin (const char *dir, const char *update_dir, const char *repository,
+              const char *tag, const char *date, int nonbranch, int warn,
+              int dotemplate)
+{
+    FILE *fout;
+    char *cp;
+    char *reposcopy;
+    char *tmp;
+
+    TRACE (TRACE_FUNCTION, "Create_Admin (%s, %s, %s, %s, %s, %d, %d, %d)",
+          dir, update_dir, repository, tag ? tag : "",
+          date ? date : "", nonbranch, warn, dotemplate);
+
+    if (noexec)
+       return 0;
+
+    tmp = Xasprintf ("%s/%s", dir, CVSADM);
+    if (isfile (tmp))
+       error (1, 0, "there is a version in %s already", update_dir);
+
+    if (CVS_MKDIR (tmp, 0777) < 0)
+    {
+       free (tmp);
+       tmp = NULL;
+
+       /* We want to print out the entire update_dir, since a lot of
+          our code calls this function with dir == "." or dir ==
+          NULL.  I hope that gives enough information in cases like
+          absolute pathnames; printing out xgetcwd() or something would
+          be way too verbose in the common cases.  */
+
+       if (warn)
+       {
+           /* The reason that this is a warning, rather than silently
+              just skipping creating the directory, is that we don't want
+              CVS's behavior to vary subtly based on factors (like directory
+              permissions) which are not made clear to the user.  With
+              the warning at least we let them know what is going on.  */
+           error (0, errno, "warning: cannot make directory %s in %s",
+                  CVSADM, update_dir);
+           return 1;
+       }
+       else
+           error (1, errno, "cannot make directory %s in %s",
+                  CVSADM, update_dir);
+    }
+    else
+    {
+       free (tmp);
+       tmp = NULL;
+    }
+
+    /* record the current cvs root for later use */
+
+    Create_Root (dir, original_parsed_root->original);
+    if (dir != NULL)
+       tmp = Xasprintf ("%s/%s", dir, CVSADM_REP);
+    else
+       tmp = xstrdup (CVSADM_REP);
+    fout = CVS_FOPEN (tmp, "w+");
+    if (fout == NULL)
+    {
+       if (update_dir[0] == '\0')
+           error (1, errno, "cannot open %s", tmp);
+       else
+           error (1, errno, "cannot open %s/%s", update_dir, CVSADM_REP);
+    }
+    reposcopy = xstrdup (repository);
+    Sanitize_Repository_Name (reposcopy);
+
+    /* The top level of the repository is a special case -- we need to
+       write it with an extra dot at the end.  This trailing `.' stuff
+       rubs me the wrong way -- on the other hand, I don't want to
+       spend the time making sure all of the code can handle it if we
+       don't do it. */
+
+    if (strcmp (reposcopy, current_parsed_root->directory) == 0)
+    {
+       reposcopy = xrealloc (reposcopy, strlen (reposcopy) + 3);
+       strcat (reposcopy, "/.");
+    }
+
+    cp = reposcopy;
+
+    /*
+     * If the Repository file is to hold a relative path, try to strip off
+     * the leading CVSroot argument.
+     */
+    {
+       char *path = Xasprintf ("%s/", current_parsed_root->directory);
+       if (strncmp (cp, path, strlen (path)) == 0)
+           cp += strlen (path);
+       free (path);
+    }
+
+    if (fprintf (fout, "%s\n", cp) < 0)
+    {
+       if (update_dir[0] == '\0')
+           error (1, errno, "write to %s failed", tmp);
+       else
+           error (1, errno, "write to %s/%s failed", update_dir, CVSADM_REP);
+    }
+    if (fclose (fout) == EOF)
+    {
+       if (update_dir[0] == '\0')
+           error (1, errno, "cannot close %s", tmp);
+       else
+           error (1, errno, "cannot close %s/%s", update_dir, CVSADM_REP);
+    }
+
+    /* now, do the Entries file */
+    if (dir != NULL)
+       (void) sprintf (tmp, "%s/%s", dir, CVSADM_ENT);
+    else
+       (void) strcpy (tmp, CVSADM_ENT);
+    fout = CVS_FOPEN (tmp, "w+");
+    if (fout == NULL)
+    {
+       if (update_dir[0] == '\0')
+           error (1, errno, "cannot open %s", tmp);
+       else
+           error (1, errno, "cannot open %s/%s", update_dir, CVSADM_ENT);
+    }
+    if (fclose (fout) == EOF)
+    {
+       if (update_dir[0] == '\0')
+           error (1, errno, "cannot close %s", tmp);
+       else
+           error (1, errno, "cannot close %s/%s", update_dir, CVSADM_ENT);
+    }
+
+    /* Create a new CVS/Tag file */
+    WriteTag (dir, tag, date, nonbranch, update_dir, repository);
+
+    TRACE (TRACE_FUNCTION, "Create_Admin");
+
+    free (reposcopy);
+    free (tmp);
+    return 0;
+}
Index: ccvs/src/cvs.h
diff -u ccvs/src/cvs.h:1.345.4.4 ccvs/src/cvs.h:1.345.4.5
--- ccvs/src/cvs.h:1.345.4.4    Tue Jan 10 18:42:38 2006
+++ ccvs/src/cvs.h      Thu Jan 12 18:20:31 2006
@@ -420,10 +420,6 @@
 char *gmformat_time_t (time_t unixtime);
 char *format_date_alloc (char *text);
 
-char *Name_Repository (const char *dir, const char *update_dir);
-const char *Short_Repository (const char *repository);
-void Sanitize_Repository_Name (char *repository);
-
 char *entries_time (time_t unixtime);
 time_t unix_time_stamp (const char *file);
 
Index: ccvs/src/edit.c
diff -u ccvs/src/edit.c:1.90.2.3 ccvs/src/edit.c:1.90.2.4
--- ccvs/src/edit.c:1.90.2.3    Fri Jan  6 20:37:13 2006
+++ ccvs/src/edit.c     Thu Jan 12 18:20:31 2006
@@ -29,6 +29,7 @@
 #include "base.h"
 #include "ignore.h"
 #include "recurse.h"
+#include "repos.h"
 
 #include "cvs.h"
 #include "watch.h"
Index: ccvs/src/fileattr.c
diff -u ccvs/src/fileattr.c:1.36.8.2 ccvs/src/fileattr.c:1.36.8.3
--- ccvs/src/fileattr.c:1.36.8.2        Fri Jan  6 20:37:13 2006
+++ ccvs/src/fileattr.c Thu Jan 12 18:20:31 2006
@@ -25,6 +25,8 @@
 #include "getline.h"
 
 /* CVS headers.  */
+#include "repos.h"
+
 #include "cvs.h"
 
 
Index: ccvs/src/history.c
diff -u ccvs/src/history.c:1.95.6.2 ccvs/src/history.c:1.95.6.3
--- ccvs/src/history.c:1.95.6.2 Fri Jan  6 20:37:13 2006
+++ ccvs/src/history.c  Thu Jan 12 18:20:31 2006
@@ -24,6 +24,7 @@
 
 /* CVS headers.  */
 #include "ignore.h"
+#include "repos.h"
 
 #include "cvs.h"
 
Index: ccvs/src/logmsg.c
diff -u ccvs/src/logmsg.c:1.99.6.2 ccvs/src/logmsg.c:1.99.6.3
--- ccvs/src/logmsg.c:1.99.6.2  Fri Jan  6 20:37:13 2006
+++ ccvs/src/logmsg.c   Thu Jan 12 18:20:31 2006
@@ -22,8 +22,12 @@
 #include "getline.h"
 
 /* CVS Headers.  */
+#include "repos.h"
+
 #include "cvs.h"
 
+
+
 static int find_type (Node * p, void *closure);
 static int fmt_proc (Node * p, void *closure);
 static int logfile_write (const char *repository, const char *filter,
Index: ccvs/src/rcs.c
diff -u ccvs/src/rcs.c:1.356.6.6 ccvs/src/rcs.c:1.356.6.7
--- ccvs/src/rcs.c:1.356.6.6    Wed Jan 11 04:37:08 2006
+++ ccvs/src/rcs.c      Thu Jan 12 18:20:32 2006
@@ -27,6 +27,7 @@
 /* CVS headers.  */
 #include "edit.h"
 #include "gpg.h"
+#include "repos.h"
 #include "sign.h"
 
 #include "cvs.h"
Index: ccvs/src/repos.c
diff -u /dev/null ccvs/src/repos.c:1.41.6.1
--- /dev/null   Thu Jan 12 18:20:33 2006
+++ ccvs/src/repos.c    Thu Jan 12 18:20:32 2006
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 1986-2006 The Free Software Foundation, Inc.
+ *
+ * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
+ *                                  and others.
+ *
+ * Portions Copyright (C) 1992, Brian Berliner and Jeff Polk
+ * Portions Copyright (C) 1989-1992, Brian Berliner
+ * 
+ * You may distribute under the terms of the GNU General Public License as
+ * specified in the README file that comes with the CVS source distribution.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Verify interface.  */
+#include "repos.h"
+
+/* GNULIB headers.  */
+#include "getline.h"
+
+/* CVS headers.  */
+#include "cvs.h"
+
+
+
+/* Determine the name of the RCS repository for directory DIR in the
+   current working directory, or for the current working directory
+   itself if DIR is NULL.  Returns the name in a newly-malloc'd
+   string.  On error, gives a fatal error and does not return.
+   UPDATE_DIR is the path from where cvs was invoked (for use in error
+   messages), and should contain DIR as its last component.
+   UPDATE_DIR can be NULL to signify the directory in which cvs was
+   invoked.  */
+
+char *
+Name_Repository (const char *dir, const char *update_dir)
+{
+    FILE *fpin;
+    const char *xupdate_dir;
+    char *repos = NULL;
+    size_t repos_allocated = 0;
+    char *tmp;
+    char *cp;
+
+    if (update_dir && *update_dir)
+       xupdate_dir = update_dir;
+    else
+       xupdate_dir = ".";
+
+    if (dir != NULL)
+       tmp = Xasprintf ("%s/%s", dir, CVSADM_REP);
+    else
+       tmp = xstrdup (CVSADM_REP);
+
+    /*
+     * The assumption here is that the repository is always contained in the
+     * first line of the "Repository" file.
+     */
+    fpin = CVS_FOPEN (tmp, "r");
+
+    if (fpin == NULL)
+    {
+       int save_errno = errno;
+       char *cvsadm;
+
+       if (dir != NULL)
+           cvsadm = Xasprintf ("%s/%s", dir, CVSADM);
+       else
+           cvsadm = xstrdup (CVSADM);
+
+       if (!isdir (cvsadm))
+       {
+           error (0, 0, "in directory `%s':", xupdate_dir);
+           error (1, 0, "there is no version here; do `%s checkout' first",
+                  program_name);
+       }
+       free (cvsadm);
+
+       if (existence_error (save_errno))
+       {
+           /* This occurs at least in the case where the user manually
+            * creates a directory named CVS.
+            */
+           error (0, 0, "in directory `%s':", xupdate_dir);
+           error (0, 0, "CVS directory found without administrative files.");
+           error (0, 0, "Use CVS to create the CVS directory, or rename the");
+           error (0, 0, "directory if it is intended to store something");
+           error (0, 0, "besides CVS administrative files.");
+           error (1, 0, "*PANIC* administration files missing!");
+       }
+
+       error (1, save_errno, "cannot open `%s'", tmp);
+    }
+
+    if (getline (&repos, &repos_allocated, fpin) < 0)
+    {
+       /* FIXME: should be checking for end of file separately.  */
+       error (0, 0, "in directory `%s':", xupdate_dir);
+       error (1, errno, "cannot read `%s'", CVSADM_REP);
+    }
+    if (fclose (fpin) < 0)
+       error (0, errno, "cannot close `%s'", tmp);
+    free (tmp);
+
+    if ((cp = strrchr (repos, '\n')) != NULL)
+       *cp = '\0';                     /* strip the newline */
+
+    /* If this is a relative repository pathname, turn it into an absolute
+     * one by tacking on the current root.  There is no need to grab it from
+     * the CVS/Root file via the Name_Root() function because by the time
+     * this function is called, we the contents of CVS/Root have already been
+     * compared to original_root and found to match.
+     */
+    if (!ISABSOLUTE (repos))
+    {
+       char *newrepos;
+
+       if (current_parsed_root == NULL)
+       {
+           error (0, 0, "in directory `%s:", xupdate_dir);
+           error (0, 0, "must set the CVSROOT environment variable\n");
+           error (0, 0, "or specify the '-d' option to `%s'.", program_name);
+           error (1, 0, "invalid repository setting");
+       }
+       if (pathname_levels (repos) > 0)
+       {
+           error (0, 0, "in directory `%s':", xupdate_dir);
+           error (0, 0, "`..'-relative repositories are not supported.");
+           error (1, 0, "invalid source repository");
+       }
+       newrepos = Xasprintf ("%s/%s", original_parsed_root->directory, repos);
+       free (repos);
+       repos = newrepos;
+    }
+
+    Sanitize_Repository_Name (repos);
+
+    return repos;
+}
+
+
+
+/*
+ * Return a pointer to the repository name relative to CVSROOT from a
+ * possibly fully qualified repository
+ */
+const char *
+Short_Repository (const char *repository)
+{
+    if (repository == NULL)
+       return NULL;
+
+    /* If repository matches CVSroot at the beginning, strip off CVSroot */
+    /* And skip leading '/' in rep, in case CVSroot ended with '/'. */
+    if (strncmp (original_parsed_root->directory, repository,
+                strlen (original_parsed_root->directory)) == 0)
+    {
+       const char *rep = repository + strlen (original_parsed_root->directory);
+       return (*rep == '/') ? rep+1 : rep;
+    }
+    else
+       return repository;
+}
+
+
+
+/* Sanitize the repository name (in place) by removing trailing
+ * slashes and a trailing "." if present.  It should be safe for
+ * callers to use strcat and friends to create repository names.
+ * Without this check, names like "/path/to/repos/./foo" and
+ * "/path/to/repos//foo" would be created.  For example, one
+ * significant case is the CVSROOT-detection code in commit.c.  It
+ * decides whether or not it needs to rebuild the administrative file
+ * database by doing a string compare.  If we've done a `cvs co .' to
+ * get the CVSROOT files, "/path/to/repos/./CVSROOT" and
+ * "/path/to/repos/CVSROOT" are the arguments that are compared!
+ *
+ * This function ends up being called from the same places as
+ * strip_path, though what it does is much more conservative.  Many
+ * comments about this operation (which was scattered around in
+ * several places in the source code) ran thus:
+ *
+ *    ``repository ends with "/."; omit it.  This sort of thing used
+ *    to be taken care of by strip_path.  Now we try to be more
+ *    selective.  I suspect that it would be even better to push it
+ *    back further someday, so that the trailing "/." doesn't get into
+ *    repository in the first place, but we haven't taken things that
+ *    far yet.''        --Jim Kingdon (recurse.c, 07-Sep-97)
+ */
+
+void
+Sanitize_Repository_Name (char *repository)
+{
+    size_t len;
+
+    assert (repository != NULL);
+
+    strip_trailing_slashes (repository);
+
+    len = strlen (repository);
+    if (len >= 2
+       && repository[len - 1] == '.'
+       && ISSLASH (repository[len - 2]))
+    {
+       repository[len - 2] = '\0';
+    }
+}
Index: ccvs/src/repos.h
diff -u /dev/null ccvs/src/repos.h:1.1.2.1
--- /dev/null   Thu Jan 12 18:20:33 2006
+++ ccvs/src/repos.h    Thu Jan 12 18:20:31 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef REPOS_H
+#define REPOS_H
+
+char *Name_Repository (const char *dir, const char *update_dir);
+const char *Short_Repository (const char *repository);
+void Sanitize_Repository_Name (char *repository);
+
+#endif /* REPOS_H */
Index: ccvs/src/server.c
diff -u ccvs/src/server.c:1.453.2.6 ccvs/src/server.c:1.453.2.7
--- ccvs/src/server.c:1.453.2.6 Wed Jan 11 04:37:08 2006
+++ ccvs/src/server.c   Thu Jan 12 18:20:32 2006
@@ -32,6 +32,7 @@
 #include "fileattr.h"
 #include "gpg.h"
 #include "ignore.h"
+#include "repos.h"
 #include "watch.h"
 #include "wrapper.h"
 
Index: ccvs/src/tag.c
diff -u ccvs/src/tag.c:1.142.6.3 ccvs/src/tag.c:1.142.6.4
--- ccvs/src/tag.c:1.142.6.3    Fri Jan  6 20:37:13 2006
+++ ccvs/src/tag.c      Thu Jan 12 18:20:32 2006
@@ -28,6 +28,7 @@
 #include "classify.h"
 #include "ignore.h"
 #include "recurse.h"
+#include "repos.h"
 
 #include "cvs.h"
 
Index: ccvs/src/update.c
diff -u ccvs/src/update.c:1.259.2.4 ccvs/src/update.c:1.259.2.5
--- ccvs/src/update.c:1.259.2.4 Tue Jan 10 18:42:39 2006
+++ ccvs/src/update.c   Thu Jan 12 18:20:32 2006
@@ -62,6 +62,7 @@
 #include "ignore.h"
 #include "no_diff.h"
 #include "recurse.h"
+#include "repos.h"
 #include "watch.h"
 #include "wrapper.h"
 




reply via email to

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