blob: 39793cbbd661afe7fe9b9bab2302b023e4ef1d0a [file] [log] [blame]
Thomas Rast498bcd32008-08-29 21:18:38 +02001#!/bin/sh
2
3test_description='--reverse combines with --parents'
4
Johannes Schindelin1550bb62020-11-18 23:44:36 +00005GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
Johannes Schindelin334afbc2020-11-18 23:44:19 +00006export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
Thomas Rast498bcd32008-08-29 21:18:38 +02008. ./test-lib.sh
9
10
11commit () {
12 test_tick &&
13 echo $1 > foo &&
14 git add foo &&
15 git commit -m "$1"
16}
17
18test_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 Schindelin1550bb62020-11-18 23:44:36 +000024 git checkout main &&
Thomas Rast498bcd32008-08-29 21:18:38 +020025 git merge -s ours side &&
26 commit five
27 '
28
29test_expect_success '--reverse --parents --full-history combines correctly' '
Johannes Schindelin1550bb62020-11-18 23:44:36 +000030 git rev-list --parents --full-history main -- foo |
Jeff King94221d22013-10-28 21:23:03 -040031 perl -e "print reverse <>" > expected &&
Johannes Schindelin1550bb62020-11-18 23:44:36 +000032 git rev-list --reverse --parents --full-history main -- foo \
Thomas Rast498bcd32008-08-29 21:18:38 +020033 > actual &&
Stefan Beller9c5b2fa2017-10-06 12:00:06 -070034 test_cmp expected actual
Thomas Rast498bcd32008-08-29 21:18:38 +020035 '
36
37test_expect_success '--boundary does too' '
Johannes Schindelin1550bb62020-11-18 23:44:36 +000038 git rev-list --boundary --parents --full-history main ^root -- foo |
Jeff King94221d22013-10-28 21:23:03 -040039 perl -e "print reverse <>" > expected &&
Thomas Rast498bcd32008-08-29 21:18:38 +020040 git rev-list --boundary --reverse --parents --full-history \
Johannes Schindelin1550bb62020-11-18 23:44:36 +000041 main ^root -- foo > actual &&
Stefan Beller9c5b2fa2017-10-06 12:00:06 -070042 test_cmp expected actual
Thomas Rast498bcd32008-08-29 21:18:38 +020043 '
44
45test_done