From a7d5b82a253cc607fd5ec30f34529b59061135be Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Fri, 23 Aug 2013 16:54:57 -0500 Subject: [PATCH] rebase: update branch tail after rebasing Signed-off-by: Felipe Contreras --- git-rebase--interactive.sh | 3 ++- git-rebase.sh | 3 ++- t/t1514-rev-parse-tail.sh | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 43631b4723..58cde577f1 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -621,7 +621,8 @@ do_next () { git update-ref -m "$message" $head_name $newhead $orig_head && git symbolic-ref \ -m "$GIT_REFLOG_ACTION: returning to $head_name" \ - HEAD $head_name + HEAD $head_name && + git update-ref refs/tails/${branch_name} $(git rev-parse $onto) ;; esac && { test ! -f "$state_dir"/verbose || diff --git a/git-rebase.sh b/git-rebase.sh index 8a3efa2983..560bc64235 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -143,7 +143,8 @@ move_to_original_branch () { $head_name $(git rev-parse HEAD) $orig_head && git symbolic-ref \ -m "rebase finished: returning to $head_name" \ - HEAD $head_name || + HEAD $head_name && + git update-ref refs/tails/${branch_name} $(git rev-parse $onto) || die "$(gettext "Could not move back to $head_name")" ;; esac diff --git a/t/t1514-rev-parse-tail.sh b/t/t1514-rev-parse-tail.sh index 6024b4276c..7b3482de55 100755 --- a/t/t1514-rev-parse-tail.sh +++ b/t/t1514-rev-parse-tail.sh @@ -26,4 +26,14 @@ test_expect_success 'test @{tail}' ' test_cmp expect actual ' +test_expect_success 'test rebase tail update' ' + git checkout -b next master && + echo three > content && + git commit -a -m three && + git rebase --onto next test@{tail} test && + git rev-parse test@{tail} > actual && + git rev-parse next > expect && + test_cmp expect actual +' + test_done -- 2.32.0.93.g670b81a890