Commit Diff


commit - 28cf319f780087bba863715f31d4ec417eb87a6d
commit + df3ed485f4148d31d1b555abb99fcba42c1a49b7
blob - 7a85d64a195dba5931737769c04f02796efa3258
blob + 9a5559d3174254a23c71184ba473bb3c0331afbd
--- got/got.c
+++ got/got.c
@@ -7918,9 +7918,12 @@ cmd_rebase(int argc, char *argv[])
 				goto done;
 			error = NULL;
 		} else {
-			error = got_error_msg(GOT_ERR_SAME_BRANCH,
-			    "specified branch resolves to a commit which "
-			    "is already contained in work tree's branch");
+			static char msg[128];
+			snprintf(msg, sizeof(msg),
+			    "%s is already based on %s",
+			    got_ref_get_name(branch),
+			    got_worktree_get_head_ref_name(worktree));
+			error = got_error_msg(GOT_ERR_SAME_BRANCH, msg);
 			goto done;
 		}
 		error = got_worktree_rebase_prepare(&new_base_branch,
blob - f521fb109c0e34b24829a35522b53306805f2a44
blob + 5bf2ae44883819420fe82ae946ad7f2f328b84b7
--- regress/cmdline/rebase.sh
+++ regress/cmdline/rebase.sh
@@ -173,10 +173,8 @@ test_rebase_ancestry_check() {
 		return 1
 	fi
 
-	echo -n "got: specified branch resolves to a commit " \
+	echo "got: refs/heads/newbranch is already based on refs/heads/master" \
 		> $testroot/stderr.expected
-	echo "which is already contained in work tree's branch" \
-		>> $testroot/stderr.expected
 	cmp -s $testroot/stderr.expected $testroot/stderr
 	ret="$?"
 	if [ "$ret" != "0" ]; then