| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | test_description='--reverse combines with --parents' |
| 4 | |
| 5 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
| 6 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
| 7 | |
| 8 | . ./test-lib.shscip-shell source . . `./test-lib.sh`. |
| 9 | |
| 10 | |
| 11 | commitscip-shell shell cgit 1.2.3+git20250818.80.3346409+git2.51.0-1 commit(). () { |
| 12 | test_tick && |
| 13 | echoscip-shell system . . echo. $1 > foo && |
| 14 | gitscip-shell system . . git. add foo && |
| 15 | gitscip-shell system . . 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 && |
| 24 | git checkout main && |
| 25 | git merge -s ours side && |
| 26 | commit five |
| 27 | ' |
| 28 | |
| 29 | reversescip-shell shell cgit 1.2.3+git20250818.80.3346409+git2.51.0-1 reverse(). () { |
| 30 | awkscip-shell system . . awk. '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' |
| 31 | } |
| 32 | |
| 33 | test_expect_success '--reverse --parents --full-history combines correctly' ' |
| 34 | git rev-list --parents --full-history main -- foo | reverse >expected && |
| 35 | git rev-list --reverse --parents --full-history main -- foo \ |
| 36 | > actual && |
| 37 | test_cmp expected actual |
| 38 | ' |
| 39 | |
| 40 | test_expect_success '--boundary does too' ' |
| 41 | git rev-list --boundary --parents --full-history main ^root -- foo | reverse >expected && |
| 42 | git rev-list --boundary --reverse --parents --full-history \ |
| 43 | main ^root -- foo > actual && |
| 44 | test_cmp expected actual |
| 45 | ' |
| 46 | |
| 47 | test_done |