summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2015-05-02 23:37:14 +0800
committerJunio C Hamano <gitster@pobox.com>2015-05-03 11:15:01 -0700
commit85024ab10ebcf844481c6a8ff6bb477f53f7d603 (patch)
treeb484ff6aeb463c58e5552896d8a6339d9fdaa39c
parente91756f2d512eab871712a6a78ab9ef640c2fee3 (diff)
downloadgit-85024ab10ebcf844481c6a8ff6bb477f53f7d603.tar.gz
t5520: test --rebase failure on unborn branch with index
Commit 19a7fcbf (allow pull --rebase on branch yet to be born) special cases git-pull on an unborn branch in a different code path such that git-pull --rebase is still valid even though there is no HEAD yet. This code path still ensures that there is no index in order not to lose any staged changes. Implement a test to ensure that this check is triggered. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t5520-pull.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 17c63ff6c1..34f37802ec 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -417,6 +417,17 @@ test_expect_success 'pull --rebase works on branch yet to be born' '
test_cmp expect actual
'
+test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
+ git init empty_repo2 &&
+ test_when_finished "rm -rf empty_repo2" &&
+ (
+ cd empty_repo2 &&
+ echo staged-file >staged-file &&
+ git add staged-file &&
+ test_must_fail git pull --rebase .. master
+ )
+'
+
test_expect_success 'setup for detecting upstreamed changes' '
mkdir src &&
(cd src &&