| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2009 David Kågedal |
| 4 | # |
| 5 | |
| 6 | test_description='Exercise pushing patches with --set-tree.' |
| 7 | |
| 8 | . ./test-lib.sh |
| 9 | |
| 10 | test_expect_success \ |
| 11 | 'Create initial patches' ' |
| 12 | stg init && |
| 13 | stg new A -m A && |
| 14 | echo hello world > a && |
| 15 | git add a && |
| 16 | stg refresh |
| 17 | stg new B -m B && |
| 18 | echo HELLO WORLD > a && |
| 19 | stg refresh |
| 20 | ' |
| 21 | |
| 22 | test_expect_success \ |
| 23 | 'Back up and create a partial patch' ' |
| 24 | stg pop && |
| 25 | stg new C -m C && |
| 26 | echo hello WORLD > a && |
| 27 | stg refresh |
| 28 | ' |
| 29 | |
| 30 | test_expect_success \ |
| 31 | 'Reapply patch B' ' |
| 32 | stg push --set-tree B |
| 33 | ' |
| 34 | |
| 35 | test_expect_success \ |
| 36 | 'Compare results' ' |
| 37 | stg pop -a && |
| 38 | stg push && |
| 39 | test "$(echo $(cat a))" = "hello world" && |
| 40 | stg push && |
| 41 | test "$(echo $(cat a))" = "hello WORLD" && |
| 42 | stg push && |
| 43 | test "$(echo $(cat a))" = "HELLO WORLD" |
| 44 | ' |
| 45 | |
| 46 | test_done |