[PATCH v2 0/5] commit-graph: test cleanup and modernization
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Jul 24, 2023, 16:39 UTC
- Message-ID
- <cover.1690216758.git.me@ttaylorr.com>
- In-Reply-To
- <cover.1689960606.git.me@ttaylorr.com>
Here is a reroll of my series to address a few style nitpicks in the commit-graph tests.
Much is the same from the previous round, except for:
- quotes >"$DIR/expect" to ensure that we work on all shells>
- adds a NOTE above graph_git_behavior to indicate that its second
argument cannot contain any character in $IFS.
- rebased on top of the current tip of 'master'.As usual, a range-diff is available below. Thanks in advance for your review!
Taylor Blau (5):
t/lib-commit-graph.sh: allow `graph_read_expect()` in sub-directories
t/lib-commit-graph.sh: avoid directory change in
`graph_git_behavior()`
t5318: avoid top-level directory changes
t5328: avoid top-level directory changes
t/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()`t/lib-commit-graph.sh | 34 ++- t/t5318-commit-graph.sh | 378 +++++++++++++---------------- t/t5328-commit-graph-64bit-time.sh | 54 ++--- 3 files changed, 224 insertions(+), 242 deletions(-)
Range-diff against v1:
1: 08482212630 ! 1: c81a059c181 t/lib-commit-graph.sh: allow `graph_read_expect()` in sub-directories
@@ t/lib-commit-graph.sh: graph_read_expect() {
OPTIONS=" read_generation_data"
fi
- cat >expect <<- EOF
-+ cat >$DIR/expect <<- EOF
++ cat >"$DIR/expect" <<-EOF
header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
num_commits: $1
chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL
2: 715a160903b ! 2: 115df6fe226 t/lib-commit-graph.sh: avoid directory change in `graph_git_behavior()`
@@ Commit message
Signed-off-by: Taylor Blau <me@ttaylorr.com>
## t/lib-commit-graph.sh ##
-@@ t/lib-commit-graph.sh: graph_git_behavior() {
+@@ t/lib-commit-graph.sh: graph_git_two_modes() {
+ test_cmp expect output
+ }
+
++# graph_git_behavior <name> <directory> <branch> <compare>
++#
++# Ensures that a handful of traversal operations produce the same
++# results with and without the commit-graph in use.
++#
++# NOTE: it is a bug to call this function with <directory> containing
++# any characters in $IFS.
+ graph_git_behavior() {
+ MSG=$1
+ DIR=$2
BRANCH=$3
COMPARE=$4
test_expect_success "check normal git operations: $MSG" '
3: 451ec003be8 = 3: 12ce967bafe t5318: avoid top-level directory changes
4: ba550987055 = 4: 79b3444660f t5328: avoid top-level directory changes
5: c3432f27b94 = 5: 887006eab46 t/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()`-- 2.41.0.399.g887006eab46