3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='git-checkout tests.'
17 test_expect_success setup
'
19 fill 1 2 3 4 5 >one &&
20 fill a b c d e >two &&
22 git commit -m "Initial A one, A two" &&
24 git checkout -b side &&
26 fill A B C D E >three &&
28 git update-index --add --remove one two three &&
29 git commit -m "Side M one, D two, A three" &&
34 test_expect_success
"checkout with dirty tree without -m" '
36 fill 0 1 2 3 4 5 >one &&
42 echo "happy - failed correctly"
47 test_expect_success
"checkout -m with dirty tree" '
49 git checkout -f master &&
52 fill 0 1 2 3 4 5 >one &&
53 git checkout -m side &&
55 fill " master" "* side" >expect.branch &&
56 git branch >current.branch &&
57 diff expect.branch current.branch &&
59 fill "M one" "A three" "D two" >expect.master &&
60 git diff --name-status master >current.master &&
61 diff expect.master current.master &&
63 fill "M one" >expect.side &&
64 git diff --name-status side >current.side &&
65 diff expect.side current.side &&
68 git diff --cached >current.index &&
69 diff expect.index current.index