Skip to content

Commit a21febe

Browse files
committed
t6012: make rev-list tests more interesting
As we are working to rewrite some of the revision-walk machinery, there could easily be some interesting interactions between the options that force topological constraints (--topo-order, --date-order, and --author-date-order) along with specifying a path. Add extra tests to t6012-rev-list-simplify.sh to add coverage of these interactions. To ensure interesting things occur, alter the repo data shape to have different orders depending on topo-, date-, or author-date-order. When testing using GIT_TEST_COMMIT_GRAPH, this assists in covering the new logic for topo-order walks using generation numbers. The extra tests can be added indepently. Signed-off-by: Derrick Stolee <[email protected]>
1 parent aa0bb22 commit a21febe

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

t/t6012-rev-list-simplify.sh

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ unnote () {
1212
git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g"
1313
}
1414

15+
#
16+
# Create a test repo with interesting commit graph:
17+
#
18+
# A--B----------G--H--I--K--L
19+
# \ \ / /
20+
# \ \ / /
21+
# C------E---F J
22+
# \_/
23+
#
24+
# The commits are laid out from left-to-right starting with
25+
# the root commit A and terminating at the tip commit L.
26+
#
27+
# There are a few places where we adjust the commit date or
28+
# author date to make the --topo-order, --date-order, and
29+
# --author-date-order flags produce different output.
30+
1531
test_expect_success setup '
1632
echo "Hi there" >file &&
1733
echo "initial" >lost &&
@@ -21,10 +37,18 @@ test_expect_success setup '
2137
2238
git branch other-branch &&
2339
40+
git symbolic-ref HEAD refs/heads/unrelated &&
41+
git rm -f "*" &&
42+
echo "Unrelated branch" >side &&
43+
git add side &&
44+
test_tick && git commit -m "Side root" &&
45+
note J &&
46+
git checkout master &&
47+
2448
echo "Hello" >file &&
2549
echo "second" >lost &&
2650
git add file lost &&
27-
test_tick && git commit -m "Modified file and lost" &&
51+
test_tick && GIT_AUTHOR_DATE=$(($test_tick + 120)) git commit -m "Modified file and lost" &&
2852
note B &&
2953
3054
git checkout other-branch &&
@@ -63,13 +87,6 @@ test_expect_success setup '
6387
test_tick && git commit -a -m "Final change" &&
6488
note I &&
6589
66-
git symbolic-ref HEAD refs/heads/unrelated &&
67-
git rm -f "*" &&
68-
echo "Unrelated branch" >side &&
69-
git add side &&
70-
test_tick && git commit -m "Side root" &&
71-
note J &&
72-
7390
git checkout master &&
7491
test_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated &&
7592
note K &&
@@ -103,14 +120,24 @@ check_result () {
103120
check_outcome success "$@"
104121
}
105122

106-
check_result 'L K J I H G F E D C B A' --full-history
123+
check_result 'L K J I H F E D C G B A' --full-history --topo-order
124+
check_result 'L K I H G F E D C B J A' --full-history
125+
check_result 'L K I H G F E D C B J A' --full-history --date-order
126+
check_result 'L K I H G F E D B C J A' --full-history --author-date-order
107127
check_result 'K I H E C B A' --full-history -- file
108128
check_result 'K I H E C B A' --full-history --topo-order -- file
109129
check_result 'K I H E C B A' --full-history --date-order -- file
130+
check_result 'K I H E B C A' --full-history --author-date-order -- file
110131
check_result 'I E C B A' --simplify-merges -- file
132+
check_result 'I E C B A' --simplify-merges --topo-order -- file
133+
check_result 'I E C B A' --simplify-merges --date-order -- file
134+
check_result 'I E B C A' --simplify-merges --author-date-order -- file
111135
check_result 'I B A' -- file
112136
check_result 'I B A' --topo-order -- file
137+
check_result 'I B A' --date-order -- file
138+
check_result 'I B A' --author-date-order -- file
113139
check_result 'H' --first-parent -- another-file
140+
check_result 'H' --first-parent --topo-order -- another-file
114141

115142
check_result 'E C B A' --full-history E -- lost
116143
test_expect_success 'full history simplification without parent' '

0 commit comments

Comments
 (0)