=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/commit.c,v retrieving revision 1.62 retrieving revision 1.63 diff -c -r1.62 -r1.63 *** src/usr.bin/cvs/commit.c 2006/05/28 07:56:44 1.62 --- src/usr.bin/cvs/commit.c 2006/05/28 10:15:35 1.63 *************** *** 1,4 **** ! /* $OpenBSD: commit.c,v 1.62 2006/05/28 07:56:44 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * --- 1,4 ---- ! /* $OpenBSD: commit.c,v 1.63 2006/05/28 10:15:35 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * *************** *** 126,132 **** cf->file_status == FILE_UNLINK) conflicts_found++; ! if (update_has_conflict_markers(cf)) { cvs_log(LP_ERR, "conflict: unresolved conflicts in %s from " "merging, please fix these first", cf->file_path); conflicts_found++; --- 126,133 ---- cf->file_status == FILE_UNLINK) conflicts_found++; ! if (cf->file_status != FILE_REMOVED && ! update_has_conflict_markers(cf)) { cvs_log(LP_ERR, "conflict: unresolved conflicts in %s from " "merging, please fix these first", cf->file_path); conflicts_found++; *************** *** 149,154 **** --- 150,156 ---- cvs_commit_local(struct cvs_file *cf) { BUF *b; + int isadded; char *d, *f, rbuf[24]; CVSENTRIES *entlist; *************** *** 161,167 **** else strlcpy(rbuf, "Non-existent", sizeof(rbuf)); ! if (cf->file_status == FILE_ADDED) { cf->repo_fd = open(cf->file_rpath, O_CREAT|O_TRUNC|O_WRONLY); if (cf->repo_fd < 0) fatal("cvs_commit_local: %s", strerror(errno)); --- 163,170 ---- else strlcpy(rbuf, "Non-existent", sizeof(rbuf)); ! isadded = (cf->file_status == FILE_ADDED && cf->file_rcs == NULL); ! if (isadded) { cf->repo_fd = open(cf->file_rpath, O_CREAT|O_TRUNC|O_WRONLY); if (cf->repo_fd < 0) fatal("cvs_commit_local: %s", strerror(errno)); *************** *** 177,183 **** 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) { --- 180,186 ---- cvs_printf("%s <- %s\n", cf->file_rpath, cf->file_path); cvs_printf("old revision: %s; ", rbuf); ! if (isadded == 0) d = commit_diff_file(cf); if (cf->file_status == FILE_REMOVED) { *************** *** 192,198 **** 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"); --- 195,201 ---- cvs_buf_putc(b, '\0'); f = cvs_buf_release(b); ! if (isadded == 0) { if (rcs_deltatext_set(cf->file_rcs, cf->file_rcs->rf_head, d) == -1) fatal("cvs_commit_local: failed to set delta"); *************** *** 206,212 **** xfree(f); ! if (cf->file_status != FILE_ADDED) xfree(d); if (cf->file_status == FILE_REMOVED) { --- 209,215 ---- xfree(f); ! if (isadded == 0) xfree(d); if (cf->file_status == FILE_REMOVED) { *************** *** 220,226 **** if (cf->file_status == FILE_REMOVED) { strlcpy(rbuf, "Removed", sizeof(rbuf)); } else if (cf->file_status == FILE_ADDED) { ! strlcpy(rbuf, "Initial Revision", sizeof(rbuf)); } else if (cf->file_status == FILE_MODIFIED) { rcsnum_tostr(cf->file_rcs->rf_head, rbuf, sizeof(rbuf)); } --- 223,233 ---- if (cf->file_status == FILE_REMOVED) { strlcpy(rbuf, "Removed", sizeof(rbuf)); } else if (cf->file_status == FILE_ADDED) { ! if (cf->file_rcs->rf_dead == 0) ! strlcpy(rbuf, "Initial Revision", sizeof(rbuf)); ! else ! rcsnum_tostr(cf->file_rcs->rf_head, ! rbuf, sizeof(rbuf)); } else if (cf->file_status == FILE_MODIFIED) { rcsnum_tostr(cf->file_rcs->rf_head, rbuf, sizeof(rbuf)); } *************** *** 253,263 **** char*delta, *p1, *p2; BUF *b1, *b2, *b3; ! if (cf->file_status == FILE_MODIFIED) { if ((b1 = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL) fatal("commit_diff_file: failed to load '%s'", cf->file_path); ! } else if (cf->file_status == FILE_REMOVED) { b1 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head); if (b1 == NULL) fatal("commit_diff_file: failed to load HEAD"); --- 260,271 ---- char*delta, *p1, *p2; BUF *b1, *b2, *b3; ! if (cf->file_status == FILE_MODIFIED || ! cf->file_status == FILE_ADDED) { if ((b1 = cvs_buf_load(cf->file_path, BUF_AUTOEXT)) == NULL) fatal("commit_diff_file: failed to load '%s'", cf->file_path); ! } else { b1 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head); if (b1 == NULL) fatal("commit_diff_file: failed to load HEAD");