]> git.ipfire.org Git - thirdparty/git.git/blob - t/t6013-rev-list-reverse-parents.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t6013-rev-list-reverse-parents.sh
1 #!/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.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 &&
24 git checkout main &&
25 git merge -s ours side &&
26 commit five
27 '
28
29 test_expect_success '--reverse --parents --full-history combines correctly' '
30 git rev-list --parents --full-history main -- foo |
31 perl -e "print reverse <>" > expected &&
32 git rev-list --reverse --parents --full-history main -- foo \
33 > actual &&
34 test_cmp expected actual
35 '
36
37 test_expect_success '--boundary does too' '
38 git rev-list --boundary --parents --full-history main ^root -- foo |
39 perl -e "print reverse <>" > expected &&
40 git rev-list --boundary --reverse --parents --full-history \
41 main ^root -- foo > actual &&
42 test_cmp expected actual
43 '
44
45 test_done