pull: do not clobber untracked files on initial pull

For a pull into an unborn branch, we do not use "git merge"
at all. Instead, we call read-tree directly. However, we
used the --reset parameter instead of "-m", which turns off
the safety features.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2011-03-25 14:13:31 -04:00
committed by Junio C Hamano
parent 44ec754dc7
commit 8c8674fc95
2 changed files with 12 additions and 1 deletions

View File

@ -46,6 +46,17 @@ test_expect_success 'pulling into void using master:master' '
test_cmp file cloned-uho/file
'
test_expect_success 'pulling into void does not overwrite untracked files' '
git init cloned-untracked &&
(
cd cloned-untracked &&
echo untracked >file &&
test_must_fail git pull .. master &&
echo untracked >expect &&
test_cmp expect file
)
'
test_expect_success 'test . as a remote' '
git branch copy master &&