summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cvs/src/commit.c')
-rw-r--r--contrib/cvs/src/commit.c132
1 files changed, 21 insertions, 111 deletions
diff --git a/contrib/cvs/src/commit.c b/contrib/cvs/src/commit.c
index 4aa2438..71b491f 100644
--- a/contrib/cvs/src/commit.c
+++ b/contrib/cvs/src/commit.c
@@ -19,7 +19,6 @@
#include "getline.h"
#include "edit.h"
#include "fileattr.h"
-#include "hardlink.h"
static Dtype check_direntproc PROTO ((void *callerdat, char *dir,
char *repos, char *update_dir,
@@ -82,6 +81,7 @@ static List *mulist;
static char *message;
static time_t last_register_time;
+
static const char *const commit_usage[] =
{
"Usage: %s %s [-nRlf] [-m msg | -F logfile] [-r rev] files...\n",
@@ -505,7 +505,7 @@ commit (argc, argv)
/* Run the user-defined script to verify/check information in
*the log message
*/
- do_verify (message, (char *)NULL);
+ do_verify (&message, (char *)NULL);
/* We always send some sort of message, even if empty. */
/* FIXME: is that true? There seems to be some code in do_editor
@@ -622,23 +622,10 @@ commit (argc, argv)
lock_tree_for_write (argc, argv, local, aflag);
/*
- * Set up the master update list and hard link list
+ * Set up the master update list
*/
mulist = getlist ();
-#ifdef PRESERVE_PERMISSIONS_SUPPORT
- if (preserve_perms)
- {
- hardlist = getlist ();
-
- /*
- * We need to save the working directory so that
- * check_fileproc can construct a full pathname for each file.
- */
- working_dir = xgetwd();
- }
-#endif
-
/*
* Run the recursion processor to verify the files are all up-to-date
*/
@@ -651,17 +638,6 @@ commit (argc, argv)
error (1, 0, "correct above errors first!");
}
-#ifdef PRESERVE_PERMISSIONS_SUPPORT
- if (preserve_perms)
- {
- /* hardlist now includes a complete index of the files
- to be committed, indexed by inode. For each inode,
- compile a list of the files that are linked to it,
- and save this list in each file's hardlink_info node. */
- (void) walklist (hardlist, cache_hardlinks_proc, NULL);
- }
-#endif
-
/*
* Run the recursion processor to commit the files
*/
@@ -1016,43 +992,6 @@ warning: file `%s' seems to still contain conflict indicators",
ci->options = xstrdup(vers->options);
p->data = (char *) ci;
(void) addnode (cilist, p);
-
-#ifdef PRESERVE_PERMISSIONS_SUPPORT
- if (preserve_perms)
- {
- /* Add this file to hardlist, indexed on its inode. When
- we are done, we can find out what files are hardlinked
- to a given file by looking up its inode in hardlist. */
- char *fullpath;
- Node *linkp;
- struct hardlink_info *hlinfo;
-
- /* Get the full pathname of the current file. */
- fullpath = xmalloc (strlen(working_dir) +
- strlen(finfo->fullname) + 2);
- sprintf (fullpath, "%s/%s", working_dir, finfo->fullname);
-
- /* To permit following links in subdirectories, files
- are keyed on finfo->fullname, not on finfo->name. */
- linkp = lookup_file_by_inode (fullpath);
-
- /* If linkp is NULL, the file doesn't exist... maybe
- we're doing a remove operation? */
- if (linkp != NULL)
- {
- /* Create a new hardlink_info node, which will record
- the current file's status and the links listed in its
- `hardlinks' delta field. We will append this
- hardlink_info node to the appropriate hardlist entry. */
- hlinfo = (struct hardlink_info *)
- xmalloc (sizeof (struct hardlink_info));
- hlinfo->status = status;
- hlinfo->links = NULL;
- linkp->data = (char *) hlinfo;
- }
- }
-#endif
-
break;
case T_UNKNOWN:
error (0, 0, "nothing known about `%s'", finfo->fullname);
@@ -1239,7 +1178,7 @@ commit_fileproc (callerdat, finfo)
got_message = 1;
if (use_editor)
do_editor (finfo->update_dir, &message, finfo->repository, ulist);
- do_verify (message, finfo->repository);
+ do_verify (&message, finfo->repository);
}
p = findnode (cilist, finfo->file);
@@ -1341,9 +1280,8 @@ commit_fileproc (callerdat, finfo)
/* Doesn't matter, it won't get checked. */
SERVER_UPDATED,
- (mode_t) -1,
- (unsigned char *) NULL,
- (struct buffer *) NULL);
+ (struct stat *) NULL,
+ (unsigned char *) NULL);
}
#endif
}
@@ -1530,7 +1468,7 @@ commit_direntproc (callerdat, dir, repos, update_dir, entries)
got_message = 1;
if (use_editor)
do_editor (update_dir, &message, real_repos, ulist);
- do_verify (message, real_repos);
+ do_verify (&message, real_repos);
free (real_repos);
return (R_PROCESS);
}
@@ -1707,8 +1645,9 @@ remove_file (finfo, tag, message)
(RCSCHECKOUTPROC) NULL, (void *) NULL);
if (retcode != 0)
{
- error (0, 0,
- "failed to check out `%s'", finfo->fullname);
+ if (!quiet)
+ error (0, retcode == -1 ? errno : 0,
+ "failed to check out `%s'", finfo->fullname);
return (1);
}
@@ -2042,21 +1981,13 @@ internal error: `%s' didn't move out of the attic",
if (tag && newfile)
{
char *tmp;
- FILE *fp;
/* move the new file out of the way. */
fname = xmalloc (strlen (file) + sizeof (CVSADM)
+ sizeof (CVSPREFIX) + 10);
(void) sprintf (fname, "%s/%s%s", CVSADM, CVSPREFIX, file);
rename_file (file, fname);
-
- /* Create empty FILE. Can't use copy_file with a DEVNULL
- argument -- copy_file now ignores device files. */
- fp = fopen (file, "w");
- if (fp == NULL)
- error (1, errno, "cannot open %s for writing", file);
- if (fclose (fp) < 0)
- error (0, errno, "cannot close %s", file);
+ copy_file (DEVNULL, file);
tmp = xmalloc (strlen (file) + strlen (tag) + 80);
/* commit a dead revision. */
@@ -2128,6 +2059,8 @@ internal error: `%s' didn't move out of the attic",
char *head;
char *magicrev;
+ fixbranch(rcsfile, sbranch);
+
head = RCS_getversion (rcsfile, NULL, NULL, 0, (int *) NULL);
magicrev = RCS_magicrev (rcsfile, head);
@@ -2225,31 +2158,18 @@ lock_RCS (user, rcs, rev, repository)
{
(void) RCS_lock(rcs, rev, 1);
}
-
- /* We used to call RCS_rewrite here, and that might seem
- appropriate in order to write out the locked revision
- information. However, such a call would actually serve no
- purpose. CVS locks will prevent any interference from other
- CVS processes. The comment above rcs_internal_lockfile
- explains that it is already unsafe to use RCS and CVS
- simultaneously. It follows that writing out the locked
- revision information here would add no additional security.
-
- If we ever do care about it, the proper fix is to create the
- RCS lock file before calling this function, and maintain it
- until the checkin is complete.
-
- The call to RCS_lock is still required at present, since in
- some cases RCS_checkin will determine which revision to check
- in by looking for a lock. FIXME: This is rather roundabout,
- and a more straightforward approach would probably be easier to
- understand. */
+ RCS_rewrite (rcs, NULL, NULL);
if (err == 0)
{
if (sbranch != NULL)
free (sbranch);
- sbranch = branch;
+ if (branch)
+ {
+ sbranch = branch;
+ }
+ else
+ sbranch = NULL;
return (0);
}
@@ -2264,8 +2184,7 @@ lock_RCS (user, rcs, rev, repository)
/* Called when "add"ing files to the RCS respository. It doesn't seem to
be possible to get RCS to use the right mode, so we change it after
- the fact. TODO: now that RCS has been librarified, we have the power
- to change this. */
+ the fact. */
static void
fix_rcs_modes (rcs, user)
@@ -2275,12 +2194,6 @@ fix_rcs_modes (rcs, user)
struct stat sb;
mode_t rcs_mode;
-#ifdef PRESERVE_PERMISSIONS_SUPPORT
- /* Do ye nothing to the modes on a symbolic link. */
- if (preserve_perms && islink (user))
- return;
-#endif
-
if (CVS_STAT (user, &sb) < 0)
{
/* FIXME: Should be ->fullname. */
@@ -2290,9 +2203,6 @@ fix_rcs_modes (rcs, user)
/* Now we compute the new mode.
- TODO: decide whether this whole thing can/should be skipped
- when `preserve_perms' is set. Almost certainly so. -twp
-
The algorithm that we use is:
Write permission is always off (this is what RCS and CVS have always
OpenPOWER on IntegriCloud