| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2008 Dmitry V. Levin |
| 4 | # |
| 5 | |
| 6 | test_description='fetch exit status test' |
| 7 | |
| 8 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
| 9 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
| 10 | |
| 11 | . ./test-lib.sh |
| 12 | |
| 13 | test_expect_success setup ' |
| 14 | |
| 15 | >file && |
| 16 | git add file && |
| 17 | git commit -m initial && |
| 18 | |
| 19 | git checkout -b side && |
| 20 | echo side >file && |
| 21 | git commit -a -m side && |
| 22 | |
| 23 | git checkout main && |
| 24 | echo next >file && |
| 25 | git commit -a -m next |
| 26 | ' |
| 27 | |
| 28 | test_expect_success 'non-fast-forward fetch' ' |
| 29 | |
| 30 | test_must_fail git fetch . main:side |
| 31 | |
| 32 | ' |
| 33 | |
| 34 | test_expect_success 'forced update' ' |
| 35 | |
| 36 | git fetch . +main:side |
| 37 | |
| 38 | ' |
| 39 | |
| 40 | test_done |