Commit Diff


commit - 272a1371f13b6ed4076eb8f9ff4a910cd0a47ed7
commit + a0ea4fc07b81c69fa0409a2e39e702659f256179
blob - bae230ad52c65d68bd3f6029df3dd6f86a87784c
blob + 021418d817308d0e1fea429b3210b838b1a14ab3
--- got/got.c
+++ got/got.c
@@ -5135,6 +5135,35 @@ get_short_logmsg(char **logmsg, int limit, struct got_
 	trim_logmsg(*logmsg, limit);
 done:
 	free(logmsg0);
+	return err;
+}
+
+static const struct got_error *
+show_rebase_merge_conflict(struct got_object_id *id, struct got_repository *repo)
+{
+	const struct got_error *err;
+	struct got_commit_object *commit = NULL;
+	char *id_str = NULL, *logmsg = NULL;
+
+	err = got_object_open_as_commit(&commit, repo, id);
+	if (err)
+		return err;
+
+	err = got_object_id_str(&id_str, id);
+	if (err)
+		goto done;
+
+	id_str[12] = '\0';
+
+	err = get_short_logmsg(&logmsg, 42, commit);
+	if (err)
+		goto done;
+
+	printf("%s -> merge conflict: %s\n", id_str, logmsg);
+done:
+	free(id_str);
+	got_object_commit_close(commit);
+	free(logmsg);
 	return err;
 }
 
@@ -5586,6 +5615,9 @@ cmd_rebase(int argc, char *argv[])
 			goto done;
 
 		if (rebase_status == GOT_STATUS_CONFLICT) {
+			error = show_rebase_merge_conflict(qid->id, repo);
+			if (error)
+				goto done;
 			got_worktree_rebase_pathlist_free(&merged_paths);
 			break;
 		}
@@ -6761,6 +6793,10 @@ cmd_histedit(int argc, char *argv[])
 		commit = NULL;
 
 		if (rebase_status == GOT_STATUS_CONFLICT) {
+			error = show_rebase_merge_conflict(hle->commit_id,
+			    repo);
+			if (error)
+				goto done;
 			got_worktree_rebase_pathlist_free(&merged_paths);
 			break;
 		}
blob - 0537513b070d67823f9627435e20abc014c5c330
blob + 262922a8781a97382dedbb832e92a3f68736454d
--- regress/cmdline/rebase.sh
+++ regress/cmdline/rebase.sh
@@ -182,6 +182,7 @@ function test_rebase_continue {
 	echo "modified alpha on branch" > $testroot/repo/alpha
 	git_commit $testroot/repo -m "committing to alpha on newbranch"
 	local orig_commit1=`git_show_head $testroot/repo`
+	local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
 
 	(cd $testroot/repo && git checkout -q master)
 	echo "modified alpha on master" > $testroot/repo/alpha
@@ -199,6 +200,9 @@ function test_rebase_continue {
 		2> $testroot/stderr)
 
 	echo "C  alpha" > $testroot/stdout.expected
+	echo -n "$short_orig_commit1 -> merge conflict" \
+		>> $testroot/stdout.expected
+	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -276,8 +280,6 @@ function test_rebase_continue {
 
 	(cd $testroot/repo && git checkout -q newbranch)
 	local new_commit1=`git_show_head $testroot/repo`
-
-	local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
 	local short_new_commit1=`trim_obj_id 28 $new_commit1`
 
 	echo -n "$short_orig_commit1 -> $short_new_commit1" \
@@ -315,6 +317,7 @@ function test_rebase_abort {
 	echo "modified alpha on branch" > $testroot/repo/alpha
 	git_commit $testroot/repo -m "committing to alpha on newbranch"
 	local orig_commit1=`git_show_head $testroot/repo`
+	local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
 
 	(cd $testroot/repo && git checkout -q master)
 	echo "modified alpha on master" > $testroot/repo/alpha
@@ -332,6 +335,9 @@ function test_rebase_abort {
 		2> $testroot/stderr)
 
 	echo "C  alpha" > $testroot/stdout.expected
+	echo -n "$short_orig_commit1 -> merge conflict" \
+		>> $testroot/stdout.expected
+	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -427,6 +433,7 @@ function test_rebase_no_op_change {
 	echo "modified alpha on branch" > $testroot/repo/alpha
 	git_commit $testroot/repo -m "committing to alpha on newbranch"
 	local orig_commit1=`git_show_head $testroot/repo`
+	local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
 
 	(cd $testroot/repo && git checkout -q master)
 	echo "modified alpha on master" > $testroot/repo/alpha
@@ -444,6 +451,9 @@ function test_rebase_no_op_change {
 		2> $testroot/stderr)
 
 	echo "C  alpha" > $testroot/stdout.expected
+	echo -n "$short_orig_commit1 -> merge conflict" \
+		>> $testroot/stdout.expected
+	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then
@@ -498,8 +508,6 @@ function test_rebase_no_op_change {
 
 	(cd $testroot/repo && git checkout -q newbranch)
 	local new_commit1=`git_show_head $testroot/repo`
-
-	local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
 
 	echo -n "$short_orig_commit1 -> no-op change" \
 		> $testroot/stdout.expected
@@ -536,6 +544,7 @@ function test_rebase_in_progress {
 	echo "modified alpha on branch" > $testroot/repo/alpha
 	git_commit $testroot/repo -m "committing to alpha on newbranch"
 	local orig_commit1=`git_show_head $testroot/repo`
+	local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
 
 	(cd $testroot/repo && git checkout -q master)
 	echo "modified alpha on master" > $testroot/repo/alpha
@@ -553,6 +562,9 @@ function test_rebase_in_progress {
 		2> $testroot/stderr)
 
 	echo "C  alpha" > $testroot/stdout.expected
+	echo -n "$short_orig_commit1 -> merge conflict" \
+		>> $testroot/stdout.expected
+	echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"
 	if [ "$ret" != "0" ]; then