| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2006 David Kågedal |
| 4 | # |
| 5 | |
| 6 | test_description='Exercise push conflicts. |
| 7 | |
| 8 | Test that the index has no modifications after a push with conflicts. |
| 9 | ' |
| 10 | |
| 11 | . ./test-lib.sh |
| 12 | |
| 13 | test_expect_success \ |
| 14 | 'Initialize the StGIT repository' \ |
| 15 | 'stg init |
| 16 | ' |
| 17 | |
| 18 | test_expect_success \ |
| 19 | 'Create the first patch' \ |
| 20 | ' |
| 21 | stg new foo -m foo && |
| 22 | echo foo > test && |
| 23 | echo fie > test2 && |
| 24 | git add test test2 && |
| 25 | stg refresh && |
| 26 | stg pop |
| 27 | ' |
| 28 | |
| 29 | test_expect_success \ |
| 30 | 'Create the second patch' \ |
| 31 | ' |
| 32 | stg new bar -m bar && |
| 33 | echo bar > test && |
| 34 | git add test && |
| 35 | stg refresh |
| 36 | ' |
| 37 | |
| 38 | test_expect_success \ |
| 39 | 'Push the first patch with conflict' \ |
| 40 | ' |
| 41 | ! stg push foo |
| 42 | ' |
| 43 | |
| 44 | test_expect_success \ |
| 45 | 'Show the, now empty, first patch' \ |
| 46 | ' |
| 47 | ! stg show foo | grep -q -e "^diff " |
| 48 | ' |
| 49 | |
| 50 | test_expect_success \ |
| 51 | 'Check that the index has the non-conflict updates' \ |
| 52 | ' |
| 53 | git diff --cached --stat | grep -q -e "^ test2 | *1 " |
| 54 | ' |
| 55 | |
| 56 | test_expect_success \ |
| 57 | 'Check that pop will fail while there are unmerged conflicts' \ |
| 58 | ' |
| 59 | ! stg pop |
| 60 | ' |
| 61 | |
| 62 | test_expect_success \ |
| 63 | 'Resolve the conflict' \ |
| 64 | ' |
| 65 | echo resolved > test && |
| 66 | git add test && |
| 67 | stg refresh |
| 68 | ' |
| 69 | |
| 70 | test_done |