Junio C Hamano | 6738c81 | 2007-11-08 01:38:12 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='forced push to replace commit we do not have' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success setup ' |
| 8 | |
| 9 | >file1 && git add file1 && test_tick && |
| 10 | git commit -m Initial && |
Junio C Hamano | acd2a45 | 2009-02-11 02:28:03 -0800 | [diff] [blame] | 11 | git config receive.denyCurrentBranch warn && |
Junio C Hamano | 6738c81 | 2007-11-08 01:38:12 -0800 | [diff] [blame] | 12 | |
| 13 | mkdir another && ( |
| 14 | cd another && |
| 15 | git init && |
Johannes Schindelin | 8ee5d73 | 2008-10-13 11:36:52 +0200 | [diff] [blame] | 16 | git fetch --update-head-ok .. master:master |
Junio C Hamano | 6738c81 | 2007-11-08 01:38:12 -0800 | [diff] [blame] | 17 | ) && |
| 18 | |
| 19 | >file2 && git add file2 && test_tick && |
| 20 | git commit -m Second |
| 21 | |
| 22 | ' |
| 23 | |
| 24 | test_expect_success 'non forced push should die not segfault' ' |
| 25 | |
| 26 | ( |
| 27 | cd another && |
| 28 | git push .. master:master |
| 29 | test $? = 1 |
| 30 | ) |
| 31 | |
| 32 | ' |
| 33 | |
| 34 | test_expect_success 'forced push should succeed' ' |
| 35 | |
| 36 | ( |
| 37 | cd another && |
| 38 | git push .. +master:master |
| 39 | ) |
| 40 | |
| 41 | ' |
| 42 | |
| 43 | test_done |