Dmitry V. Levin | efb98b4 | 2008-05-28 19:29:36 +0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2008 Dmitry V. Levin |
| 4 | # |
| 5 | |
| 6 | test_description='fetch exit status test' |
| 7 | |
Johannes Schindelin | bc925ce | 2020-11-18 23:44:32 +0000 | [diff] [blame] | 8 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
Johannes Schindelin | 334afbc | 2020-11-18 23:44:19 +0000 | [diff] [blame] | 9 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
| 10 | |
Ævar Arnfjörð Bjarmason | 7a98d9a | 2022-04-13 22:01:47 +0200 | [diff] [blame] | 11 | TEST_PASSES_SANITIZE_LEAK=true |
Dmitry V. Levin | efb98b4 | 2008-05-28 19:29:36 +0400 | [diff] [blame] | 12 | . ./test-lib.sh |
| 13 | |
| 14 | test_expect_success setup ' |
| 15 | |
| 16 | >file && |
| 17 | git add file && |
| 18 | git commit -m initial && |
| 19 | |
| 20 | git checkout -b side && |
| 21 | echo side >file && |
| 22 | git commit -a -m side && |
| 23 | |
Johannes Schindelin | bc925ce | 2020-11-18 23:44:32 +0000 | [diff] [blame] | 24 | git checkout main && |
Dmitry V. Levin | efb98b4 | 2008-05-28 19:29:36 +0400 | [diff] [blame] | 25 | echo next >file && |
| 26 | git commit -a -m next |
| 27 | ' |
| 28 | |
Felipe Contreras | a75d7b5 | 2009-10-24 11:31:32 +0300 | [diff] [blame] | 29 | test_expect_success 'non-fast-forward fetch' ' |
Dmitry V. Levin | efb98b4 | 2008-05-28 19:29:36 +0400 | [diff] [blame] | 30 | |
Johannes Schindelin | bc925ce | 2020-11-18 23:44:32 +0000 | [diff] [blame] | 31 | test_must_fail git fetch . main:side |
Dmitry V. Levin | efb98b4 | 2008-05-28 19:29:36 +0400 | [diff] [blame] | 32 | |
| 33 | ' |
| 34 | |
| 35 | test_expect_success 'forced update' ' |
| 36 | |
Johannes Schindelin | bc925ce | 2020-11-18 23:44:32 +0000 | [diff] [blame] | 37 | git fetch . +main:side |
Dmitry V. Levin | efb98b4 | 2008-05-28 19:29:36 +0400 | [diff] [blame] | 38 | |
| 39 | ' |
| 40 | |
| 41 | test_done |