Commit c1b057235b48f7b8bc01bd3c31348517856bc68b

Stefan Sperling 2021-09-28T20:56:05

make 'got merge' interrupt the merge upon undeleted and unversioned files

diff --git a/got/got.c b/got/got.c
index 46e4398..5aa3eb4 100644
--- a/got/got.c
+++ b/got/got.c
@@ -10824,24 +10824,26 @@ cmd_merge(int argc, char *argv[])
 		if (error)
 			goto done;
 		printf("Merge of %s interrupted on request\n", branch_name);
-	} else if (upa.conflicts > 0 || upa.missing > 0) {
+	} else if (upa.conflicts > 0 || upa.missing > 0 ||
+	    upa.not_deleted > 0 || upa.unversioned > 0) {
 		error = got_worktree_merge_postpone(worktree, fileindex);
 		if (error)
 			goto done;
-		if (upa.conflicts > 0 && upa.missing == 0) {
+		if (upa.conflicts > 0 && upa.missing == 0 &&
+		    upa.not_deleted == 0 && upa.unversioned == 0) {
 			error = got_error_msg(GOT_ERR_CONFLICTS,
 			    "conflicts must be resolved before merging "
 			    "can continue");
 		} else if (upa.conflicts > 0) {
 			error = got_error_msg(GOT_ERR_CONFLICTS,
 			    "conflicts must be resolved before merging "
-			    "can continue; changes destined for missing "
+			    "can continue; changes destined for some "
 			    "files were not yet merged and "
 			    "should be merged manually if required before the "
 			    "merge operation is continued");
 		} else {
 			error = got_error_msg(GOT_ERR_CONFLICTS,
-			    "changes destined for missing "
+			    "changes destined for some "
 			    "files were not yet merged and should be "
 			    "merged manually if required before the "
 			    "merge operation is continued");
diff --git a/regress/cmdline/merge.sh b/regress/cmdline/merge.sh
index 9ccf58a..be7e587 100755
--- a/regress/cmdline/merge.sh
+++ b/regress/cmdline/merge.sh
@@ -997,7 +997,7 @@ test_merge_missing_file() {
 		return 1
 	fi
 
-	echo -n "got: changes destined for missing files " \
+	echo -n "got: changes destined for some files " \
 		> $testroot/stderr.expected
 	echo -n "were not yet merged and should be merged manually if " \
 		>> $testroot/stderr.expected