| 1 | #!/bin/sh |
| 2 | test_description='Handle files with non-ASCII characters in their names' |
| 3 | |
| 4 | . ./test-lib.sh |
| 5 | |
| 6 | # Ignore our own output files. |
| 7 | cat > .git/info/exclude <<EOF |
| 8 | /expected.txt |
| 9 | /output.txt |
| 10 | EOF |
| 11 | |
| 12 | test_expect_success 'Setup' ' |
| 13 | echo "Fjäderholmarna" > skärgårdsö.txt && |
| 14 | stg add skärgårdsö.txt && |
| 15 | git commit -m "Create island" && |
| 16 | stg init && |
| 17 | echo foo > unrelated.txt && |
| 18 | stg add unrelated.txt && |
| 19 | stg new p0 -m "Unrelated file" && |
| 20 | stg refresh && |
| 21 | stg pop && |
| 22 | rm skärgårdsö.txt && |
| 23 | git commit -a -m "Remove island" && |
| 24 | git tag upstream && |
| 25 | git reset --hard HEAD^ && |
| 26 | stg push |
| 27 | ' |
| 28 | |
| 29 | test_expect_success 'Rebase onto changed non-ASCII file' ' |
| 30 | stg rebase upstream |
| 31 | ' |
| 32 | |
| 33 | test_expect_success 'Setup' ' |
| 34 | stg delete p0 && |
| 35 | git reset --hard HEAD^ && |
| 36 | echo "-- ett liv mitt ute i vattnet" >> skärgårdsö.txt && |
| 37 | stg new p1 -m "Describe island" |
| 38 | ' |
| 39 | |
| 40 | cat > expected.txt <<EOF |
| 41 | M skärgårdsö.txt |
| 42 | EOF |
| 43 | test_expect_success 'Status of modified non-ASCII file' ' |
| 44 | stg status > output.txt && |
| 45 | diff -u expected.txt output.txt |
| 46 | ' |
| 47 | |
| 48 | test_expect_success 'Refresh changes to non-ASCII file' ' |
| 49 | stg refresh |
| 50 | ' |
| 51 | |
| 52 | cat > expected.txt <<EOF |
| 53 | EOF |
| 54 | test_expect_success 'Status after refresh' ' |
| 55 | stg status > output.txt && |
| 56 | diff -u expected.txt output.txt |
| 57 | ' |
| 58 | |
| 59 | test_done |