t6111: allow checking the parents as well
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
May 16, 2013 at 18:32 UTC
e16f434ab66993c58690db9b68c9506b344916f7
1 file changed
+21
-9
t/t6111-rev-list-treesame.sh
+21
-9
@@ -20,7 +20,7 @@ note () {
20
}
21
22
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"
24
}
25
26
test_expect_success setup '
@@ -66,23 +66,34 @@ test_expect_success setup '
66
test_commit M file "Parts 1+2"
67
'
68
69
-FMT='tformat:%P %H | %s'
70
-
69
# could we soup this up to optionally check parents? So "(BA)C" would check
70
# that C is shown and has parents B A.
71
check_outcome () {
72
outcome=$1
73
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
+
92
param="$*" &&
93
test_expect_$outcome "log $param" '
94
git log --format="$FMT" $param |
95
unnote >actual &&
85
- sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
96
+ sed -e "$munge_actual" <actual >check &&
97
test_cmp expect check || {
98
cat actual
99
false
@@ -99,6 +110,7 @@ check_result () {
110
# shown in normal full-history, as we can't distinguish unless we do a
111
# simplification pass. After simplification, D is dropped but G remains.
112
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'
114
check_result 'M H L K J I G E F D C B A' --topo-order
115
check_result 'M L H B A' -- file
116
check_result 'M L H B A' --parents -- file