diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-05-31 23:27:39 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-05-31 23:27:39 +0000 |
commit | d1d0b71e407590e6d922a53fa34813e49ae970db (patch) | |
tree | a96ea79d9b8d483a6839221fe90b9fa1fe0e64ae /usr.bin/cvs | |
parent | 9c6af290da0030b607397d470c73cf0c87150af8 (diff) |
when adding a new file that already exists set the previous
deltatext (the dead revision) to the correct rcs diff if the file
was modified in any way.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/commit.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index d2d9dae7c6a..ecbf62ab1f6 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.66 2006/05/31 01:26:21 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.67 2006/05/31 23:27:38 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -150,6 +150,7 @@ void cvs_commit_local(struct cvs_file *cf) { BUF *b; + int isnew; int l, openflags, rcsflags; char *d, *f, rbuf[24]; CVSENTRIES *entlist; @@ -168,7 +169,9 @@ cvs_commit_local(struct cvs_file *cf) else strlcpy(rbuf, "Non-existent", sizeof(rbuf)); + isnew = 0; if (cf->file_status == FILE_ADDED) { + isnew = 1; rcsflags = RCS_CREATE; openflags = O_CREAT | O_TRUNC | O_WRONLY; if (cf->file_rcs != NULL) { @@ -201,6 +204,7 @@ cvs_commit_local(struct cvs_file *cf) rcsflags = RCS_READ | RCS_PARSE_FULLY; openflags = O_RDONLY; rcs_close(cf->file_rcs); + isnew = 0; } cf->repo_fd = open(cf->file_rpath, openflags); @@ -218,7 +222,7 @@ cvs_commit_local(struct cvs_file *cf) cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); cvs_printf("old revision: %s; ", rbuf); - if (cf->file_status != FILE_ADDED) + if (isnew == 0) d = commit_diff_file(cf); if (cf->file_status == FILE_REMOVED) { @@ -233,7 +237,7 @@ cvs_commit_local(struct cvs_file *cf) cvs_buf_putc(b, '\0'); f = cvs_buf_release(b); - if (cf->file_status != FILE_ADDED) { + if (isnew == 0) { if (rcs_deltatext_set(cf->file_rcs, cf->file_rcs->rf_head, d) == -1) fatal("cvs_commit_local: failed to set delta"); @@ -247,7 +251,7 @@ cvs_commit_local(struct cvs_file *cf) xfree(f); - if (cf->file_status != FILE_ADDED) + if (isnew == 0) xfree(d); if (cf->file_status == FILE_REMOVED) { |