| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git update-index --assume-unchanged test. |
| 4 | ' |
| 5 | |
| 6 | . ./test-lib.sh |
| 7 | |
| 8 | test_expect_success 'setup' ' |
| 9 | : >file && |
| 10 | git add file && |
| 11 | git commit -m initial && |
| 12 | git branch other && |
| 13 | echo upstream >file && |
| 14 | git add file && |
| 15 | git commit -m upstream |
| 16 | ' |
| 17 | |
| 18 | test_expect_success 'do not switch branches with dirty file' ' |
| 19 | git reset --hard && |
| 20 | git checkout other && |
| 21 | echo dirt >file && |
| 22 | git update-index --assume-unchanged file && |
| 23 | test_must_fail git checkout - 2>err && |
| 24 | test_grep overwritten err |
| 25 | ' |
| 26 | |
| 27 | test_done |