Skip to content

Commit e16f434

Browse files
committed
t6111: allow checking the parents as well
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent abdea96 commit e16f434

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

t/t6111-rev-list-treesame.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ note () {
2020
}
2121

2222
unnote () {
23-
git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
23+
git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\))\([ ]\)|\1\2|g"
2424
}
2525

2626
test_expect_success setup '
@@ -66,23 +66,34 @@ test_expect_success setup '
6666
test_commit M file "Parts 1+2"
6767
'
6868

69-
FMT='tformat:%P %H | %s'
70-
7169
# could we soup this up to optionally check parents? So "(BA)C" would check
7270
# that C is shown and has parents B A.
7371
check_outcome () {
7472
outcome=$1
7573
shift
76-
for c in $1
77-
do
78-
echo "$c"
79-
done >expect &&
80-
shift &&
74+
75+
case "$1" in
76+
*"("*)
77+
FMT="%P %H | %s"
78+
munge_actual="
79+
s/^\([^ ]*\) \([^ ]*\) .*/(\1)\2/
80+
s/ //g
81+
s/()//
82+
"
83+
;;
84+
*)
85+
FMT="%H | %s"
86+
munge_actual="s/^\([^ ]*\) .*/\1/"
87+
;;
88+
esac &&
89+
printf "%s\n" $1 >expect &&
90+
shift
91+
8192
param="$*" &&
8293
test_expect_$outcome "log $param" '
8394
git log --format="$FMT" $param |
8495
unnote >actual &&
85-
sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
96+
sed -e "$munge_actual" <actual >check &&
8697
test_cmp expect check || {
8798
cat actual
8899
false
@@ -99,6 +110,7 @@ check_result () {
99110
# shown in normal full-history, as we can't distinguish unless we do a
100111
# simplification pass. After simplification, D is dropped but G remains.
101112
check_result 'M L K J I H G F E D C B A'
113+
check_result '(LH)M (K)L (GJ)K (I)J (G)I (G)H (FE)G (D)F (B)E (BC)D (A)C (A)B A'
102114
check_result 'M H L K J I G E F D C B A' --topo-order
103115
check_result 'M L H B A' -- file
104116
check_result 'M L H B A' --parents -- file

0 commit comments

Comments
 (0)