inform the user when switching branches
diff --git a/got/got.c b/got/got.c
index 032ff72..4268650 100644
--- a/got/got.c
+++ b/got/got.c
@@ -672,6 +672,9 @@ cmd_update(int argc, char *argv[])
error = check_same_branch(commit_id, head_ref, repo);
if (error)
goto done;
+ printf("Switching work tree from %s to %s\n",
+ got_worktree_get_head_ref_name(worktree),
+ got_ref_get_name(head_ref));
error = got_worktree_set_head_ref(worktree, head_ref);
if (error)
goto done;
diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh
index 13de6cc..cb0b306 100755
--- a/regress/cmdline/update.sh
+++ b/regress/cmdline/update.sh
@@ -1338,7 +1338,8 @@ function test_update_to_another_branch {
echo "modified alpha in work tree" > $testroot/wt/alpha
- echo "C alpha" > $testroot/stdout.expected
+ echo "Switching work tree from refs/heads/master to refs/heads/newbranch" > $testroot/stdout.expected
+ echo "C alpha" >> $testroot/stdout.expected
echo -n "Updated to commit " >> $testroot/stdout.expected
git_show_head $testroot/repo >> $testroot/stdout.expected
echo >> $testroot/stdout.expected