Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='--reverse combines with --parents' |
| 4 | |
Johannes Schindelin | 1550bb6 | 2020-11-18 23:44:36 +0000 | [diff] [blame] | 5 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
Johannes Schindelin | 334afbc | 2020-11-18 23:44:19 +0000 | [diff] [blame] | 6 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
| 7 | |
Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 8 | . ./test-lib.sh |
| 9 | |
| 10 | |
| 11 | commit () { |
| 12 | test_tick && |
| 13 | echo $1 > foo && |
| 14 | git add foo && |
| 15 | git commit -m "$1" |
| 16 | } |
| 17 | |
| 18 | test_expect_success 'set up --reverse example' ' |
| 19 | commit one && |
| 20 | git tag root && |
| 21 | commit two && |
| 22 | git checkout -b side HEAD^ && |
| 23 | commit three && |
Johannes Schindelin | 1550bb6 | 2020-11-18 23:44:36 +0000 | [diff] [blame] | 24 | git checkout main && |
Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 25 | git merge -s ours side && |
| 26 | commit five |
| 27 | ' |
| 28 | |
| 29 | test_expect_success '--reverse --parents --full-history combines correctly' ' |
Johannes Schindelin | 1550bb6 | 2020-11-18 23:44:36 +0000 | [diff] [blame] | 30 | git rev-list --parents --full-history main -- foo | |
Jeff King | 94221d2 | 2013-10-28 21:23:03 -0400 | [diff] [blame] | 31 | perl -e "print reverse <>" > expected && |
Johannes Schindelin | 1550bb6 | 2020-11-18 23:44:36 +0000 | [diff] [blame] | 32 | git rev-list --reverse --parents --full-history main -- foo \ |
Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 33 | > actual && |
Stefan Beller | 9c5b2fa | 2017-10-06 12:00:06 -0700 | [diff] [blame] | 34 | test_cmp expected actual |
Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 35 | ' |
| 36 | |
| 37 | test_expect_success '--boundary does too' ' |
Johannes Schindelin | 1550bb6 | 2020-11-18 23:44:36 +0000 | [diff] [blame] | 38 | git rev-list --boundary --parents --full-history main ^root -- foo | |
Jeff King | 94221d2 | 2013-10-28 21:23:03 -0400 | [diff] [blame] | 39 | perl -e "print reverse <>" > expected && |
Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 40 | git rev-list --boundary --reverse --parents --full-history \ |
Johannes Schindelin | 1550bb6 | 2020-11-18 23:44:36 +0000 | [diff] [blame] | 41 | main ^root -- foo > actual && |
Stefan Beller | 9c5b2fa | 2017-10-06 12:00:06 -0700 | [diff] [blame] | 42 | test_cmp expected actual |
Thomas Rast | 498bcd3 | 2008-08-29 21:18:38 +0200 | [diff] [blame] | 43 | ' |
| 44 | |
| 45 | test_done |