summaryrefslogtreecommitdiff
path: root/t/t5520-pull.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2009-08-12 03:27:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-08-12 22:50:09 (GMT)
commit19a7fcbf16276321f83e0c1748b3935a2ea42675 (patch)
treecd608b5e2aa4ec90785e355f830bc4880ac9be61 /t/t5520-pull.sh
parentefd17968387482f5765a969813707629b85bf74f (diff)
downloadgit-19a7fcbf16276321f83e0c1748b3935a2ea42675.zip
git-19a7fcbf16276321f83e0c1748b3935a2ea42675.tar.gz
git-19a7fcbf16276321f83e0c1748b3935a2ea42675.tar.bz2
allow pull --rebase on branch yet to be born
When doing a "pull --rebase", we check to make sure that the index and working tree are clean. The index-clean check compares the index against HEAD. The test erroneously reports dirtiness if we don't have a HEAD yet. In such an "unborn branch" case, by definition, a non-empty index won't be based on whatever we are pulling down from the remote, and will lose the local change. Just check if $GIT_DIR/index exists and error out. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5520-pull.sh')
-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 e78d402..dd2ee84 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -149,4 +149,15 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
'
+test_expect_success 'pull --rebase works on branch yet to be born' '
+ git rev-parse master >expect &&
+ mkdir empty_repo &&
+ (cd empty_repo &&
+ git init &&
+ git pull --rebase .. master &&
+ git rev-parse HEAD >../actual
+ ) &&
+ test_cmp expect actual
+'
+
test_done