=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/commit.c,v retrieving revision 1.66 retrieving revision 1.67 diff -c -r1.66 -r1.67 *** src/usr.bin/cvs/commit.c 2006/05/31 01:26:21 1.66 --- src/usr.bin/cvs/commit.c 2006/05/31 23:27:38 1.67 *************** *** 1,4 **** ! /* $OpenBSD: commit.c,v 1.66 2006/05/31 01:26:21 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * --- 1,4 ---- ! /* $OpenBSD: commit.c,v 1.67 2006/05/31 23:27:38 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * *************** *** 150,155 **** --- 150,156 ---- cvs_commit_local(struct cvs_file *cf) { BUF *b; + int isnew; int l, openflags, rcsflags; char *d, *f, rbuf[24]; CVSENTRIES *entlist; *************** *** 168,174 **** --- 169,177 ---- 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,206 **** --- 204,210 ---- 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,224 **** cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); cvs_printf("old revision: %s; ", rbuf); ! if (cf->file_status != FILE_ADDED) d = commit_diff_file(cf); if (cf->file_status == FILE_REMOVED) { --- 222,228 ---- cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); cvs_printf("old revision: %s; ", rbuf); ! if (isnew == 0) d = commit_diff_file(cf); if (cf->file_status == FILE_REMOVED) { *************** *** 233,239 **** cvs_buf_putc(b, '\0'); f = cvs_buf_release(b); ! if (cf->file_status != FILE_ADDED) { if (rcs_deltatext_set(cf->file_rcs, cf->file_rcs->rf_head, d) == -1) fatal("cvs_commit_local: failed to set delta"); --- 237,243 ---- cvs_buf_putc(b, '\0'); f = cvs_buf_release(b); ! 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,253 **** xfree(f); ! if (cf->file_status != FILE_ADDED) xfree(d); if (cf->file_status == FILE_REMOVED) { --- 251,257 ---- xfree(f); ! if (isnew == 0) xfree(d); if (cf->file_status == FILE_REMOVED) {