[PATCH v2 04/12] t5520: test --rebase with multiple branches
- From
Paul Tan <pyokagan@gmail.com>
- Date
- May 7, 2015, 08:44 UTC
- Message-ID
- <1430988248-18285-5-git-send-email-pyokagan@gmail.com>
- In-Reply-To
- <1430988248-18285-1-git-send-email-pyokagan@gmail.com>
Since rebasing on top of multiple upstream branches does not make sense, since commit 51b2ead0 ("disallow providing multiple upstream branches to rebase, pull --rebase"), git-pull explicitly disallowed specifying multiple branches in the rebase case.
Implement tests to ensure that git-pull fails and prints out the user-friendly error message in such a case.
Signed-off-by: Paul Tan <pyokagan@gmail.com> ---
Notes:
* Check that when git-pull fails, HEAD was not moved.
* Removed the not-really-required `test_when_finished "rm -f out"`.t/t5520-pull.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 99b6f67..05a92a2 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -220,6 +220,15 @@ test_expect_success '--rebase' ' test $(git rev-parse HEAD^) = $(git rev-parse copy) && test new = $(git show HEAD:file2) ' + +test_expect_success '--rebase fails with multiple branches' ' + git reset --hard before-rebase && + test_must_fail git pull --rebase . copy master 2>out && + test $(git rev-parse HEAD) = $(git rev-parse before-rebase) && + test_i18ngrep "Cannot rebase onto multiple branches" out && + test modified = "$(git show HEAD:file)" +' + test_expect_success 'pull.rebase' ' git reset --hard before-rebase && test_config pull.rebase true &&
-- 2.1.4