interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t6013-rev-list-reverse-parents.sh

47 lines · 1065 bytes Raw Blame History
1#!/bin/sh
2
3test_description='--reverse combines with --parents'
4
5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8. ./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 &&
24 git checkout main &&
25 git merge -s ours side &&
26 commit five
27 '
28
29reverse () {
30 awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }'
31}
32
33test_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
40test_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
47test_done