commit - 272a1371f13b6ed4076eb8f9ff4a910cd0a47ed7
commit + a0ea4fc07b81c69fa0409a2e39e702659f256179
blob - bae230ad52c65d68bd3f6029df3dd6f86a87784c
blob + 021418d817308d0e1fea429b3210b838b1a14ab3
--- got/got.c
+++ got/got.c
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;
}
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;
}
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
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
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
(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" \
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
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
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
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
(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
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
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