summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src/commit.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-01-21 21:53:03 +0000
committerpeter <peter@FreeBSD.org>2003-01-21 21:53:03 +0000
commit821118cc49e4fb917b543aff27dfeeb48f9959cb (patch)
treeac24d0bf3321edf74c485789b0a58c0ac84bb5fb /contrib/cvs/src/commit.c
parent3dc96f7243ece1d1f7f87b03334f840415e0db63 (diff)
downloadFreeBSD-src-821118cc49e4fb917b543aff27dfeeb48f9959cb.zip
FreeBSD-src-821118cc49e4fb917b543aff27dfeeb48f9959cb.tar.gz
Import cvs-1.11.5 onto vendor branch
Diffstat (limited to 'contrib/cvs/src/commit.c')
-rw-r--r--contrib/cvs/src/commit.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/contrib/cvs/src/commit.c b/contrib/cvs/src/commit.c
index d67d0a1..0d19d31 100644
--- a/contrib/cvs/src/commit.c
+++ b/contrib/cvs/src/commit.c
@@ -248,26 +248,7 @@ find_fileproc (callerdat, finfo)
xfinfo.rcs = NULL;
vers = Version_TS (&xfinfo, NULL, saved_tag, NULL, 0, 0);
- if (vers->ts_user == NULL
- && vers->vn_user != NULL
- && (vers->vn_user[0] == '0' || vers->vn_user[0] == '-'))
- {
- if ( vers->vn_user[0] == '0')
- {
- /* This happens when one has `cvs add'ed a file, but it no
- longer exists in the working directory at commit time. */
- status = T_ADDED;
- }
- else
- {
- /* FIXME: If vn_user is starts with "-" but ts_user is
- non-NULL, what classify_file does is print "%s should be
- removed and is still there". I'm not sure what it does
- then. We probably should do the same. */
- status = T_REMOVED;
- }
- }
- else if (vers->vn_user == NULL)
+ if (vers->vn_user == NULL)
{
if (vers->ts_user == NULL)
error (0, 0, "nothing known about `%s'", finfo->fullname);
@@ -277,16 +258,28 @@ find_fileproc (callerdat, finfo)
freevers_ts (&vers);
return 1;
}
- else if (vers->ts_user != NULL
- && vers->vn_user != NULL
- && vers->vn_user[0] == '0')
- /* FIXME: If vn_user is "0" but ts_user is NULL, what classify_file
- does is print "new-born %s has disappeared" and removes the entry.
- We probably should do the same. No! Not here. Otherwise, a commit
- would succeed in some cases when it should fail. See above. */
+ if (vers->ts_user == NULL)
+ {
+ if (strcmp (vers->vn_user, "0") == 0)
+ /* This happens when one has `cvs add'ed a file, but it no
+ longer exists in the working directory at commit time.
+ FIXME: What classify_file does in this case is print
+ "new-born %s has disappeared" and removes the entry.
+ We probably should do the same. */
+ status = T_ADDED;
+ else if (vers->vn_user[0] == '-')
+ status = T_REMOVED;
+ else
+ {
+ /* FIXME: What classify_file does in this case is print
+ "%s was lost". We probably should do the same. */
+ freevers_ts (&vers);
+ return 0;
+ }
+ }
+ else if (strcmp (vers->vn_user, "0") == 0)
status = T_ADDED;
- else if (vers->ts_user != NULL
- && vers->ts_rcs != NULL
+ else if (vers->ts_rcs != NULL
&& (args->force || strcmp (vers->ts_user, vers->ts_rcs) != 0))
/* If we are forcing commits, pretend that the file is
modified. */
@@ -427,10 +420,12 @@ commit (argc, argv)
/* numeric specified revision means we ignore sticky tags... */
if (saved_tag && isdigit ((unsigned char) *saved_tag))
{
+ char *p = saved_tag + strlen (saved_tag);
aflag = 1;
- /* strip trailing dots */
- while (saved_tag[strlen (saved_tag) - 1] == '.')
- saved_tag[strlen (saved_tag) - 1] = '\0';
+ /* strip trailing dots and leading zeros */
+ while (*--p == '.') ;
+ p[1] = '\0';
+ while (*saved_tag == '0') ++saved_tag;
}
/* some checks related to the "-F logfile" option */
@@ -466,7 +461,7 @@ commit (argc, argv)
err = start_recursion (find_fileproc, find_filesdoneproc,
find_dirent_proc, (DIRLEAVEPROC) NULL,
(void *)&find_args,
- argc, argv, local, W_LOCAL, 0, LOCK_NONE,
+ argc, argv, local, W_LOCAL, 0, CVS_LOCK_NONE,
(char *)NULL, 0);
if (err)
error (1, 0, "correct above errors first!");
@@ -647,7 +642,7 @@ commit (argc, argv)
*/
err = start_recursion (check_fileproc, check_filesdoneproc,
check_direntproc, (DIRLEAVEPROC) NULL, NULL, argc,
- argv, local, W_LOCAL, aflag, LOCK_NONE,
+ argv, local, W_LOCAL, aflag, CVS_LOCK_NONE,
(char *) NULL, 1);
if (err)
{
@@ -662,7 +657,7 @@ commit (argc, argv)
if (noexec == 0)
err = start_recursion (commit_fileproc, commit_filesdoneproc,
commit_direntproc, commit_dirleaveproc, NULL,
- argc, argv, local, W_LOCAL, aflag, LOCK_NONE,
+ argc, argv, local, W_LOCAL, aflag, CVS_LOCK_NONE,
(char *) NULL, 1);
/*
OpenPOWER on IntegriCloud