Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-11-03 00:17:39 +0300
committerJunio C Hamano <gitster@pobox.com>2020-11-03 00:17:39 +0300
commit0be2d65132d6b75b2146c28eb024568afa242739 (patch)
tree8db4469f8c907728618fe84edfda9ce83c6feab5 /t/t7900-maintenance.sh
parent307a53dd9914f65c9b6399221574e24234e4b49f (diff)
parentd334107c5da27e5212e21e77da03e938ea6db976 (diff)
Merge branch 'ds/maintenance-commit-graph-auto-fix'
Test-coverage enhancement of running commit-graph task "git maintenance" as needed led to discovery and fix of a bug. * ds/maintenance-commit-graph-auto-fix: maintenance: core.commitGraph=false prevents writes maintenance: test commit-graph auto condition
Diffstat (limited to 't/t7900-maintenance.sh')
-rwxr-xr-xt/t7900-maintenance.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 55116c2f04..b2def8bb16 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -53,6 +53,43 @@ test_expect_success 'run --task=<task>' '
test_subcommand git commit-graph write --split --reachable --no-progress <run-both.txt
'
+test_expect_success 'core.commitGraph=false prevents write process' '
+ GIT_TRACE2_EVENT="$(pwd)/no-commit-graph.txt" \
+ git -c core.commitGraph=false maintenance run \
+ --task=commit-graph 2>/dev/null &&
+ test_subcommand ! git commit-graph write --split --reachable --no-progress \
+ <no-commit-graph.txt
+'
+
+test_expect_success 'commit-graph auto condition' '
+ COMMAND="maintenance run --task=commit-graph --auto --quiet" &&
+
+ GIT_TRACE2_EVENT="$(pwd)/cg-no.txt" \
+ git -c maintenance.commit-graph.auto=1 $COMMAND &&
+ GIT_TRACE2_EVENT="$(pwd)/cg-negative-means-yes.txt" \
+ git -c maintenance.commit-graph.auto="-1" $COMMAND &&
+
+ test_commit first &&
+
+ GIT_TRACE2_EVENT="$(pwd)/cg-zero-means-no.txt" \
+ git -c maintenance.commit-graph.auto=0 $COMMAND &&
+ GIT_TRACE2_EVENT="$(pwd)/cg-one-satisfied.txt" \
+ git -c maintenance.commit-graph.auto=1 $COMMAND &&
+
+ git commit --allow-empty -m "second" &&
+ git commit --allow-empty -m "third" &&
+
+ GIT_TRACE2_EVENT="$(pwd)/cg-two-satisfied.txt" \
+ git -c maintenance.commit-graph.auto=2 $COMMAND &&
+
+ COMMIT_GRAPH_WRITE="git commit-graph write --split --reachable --no-progress" &&
+ test_subcommand ! $COMMIT_GRAPH_WRITE <cg-no.txt &&
+ test_subcommand $COMMIT_GRAPH_WRITE <cg-negative-means-yes.txt &&
+ test_subcommand ! $COMMIT_GRAPH_WRITE <cg-zero-means-no.txt &&
+ test_subcommand $COMMIT_GRAPH_WRITE <cg-one-satisfied.txt &&
+ test_subcommand $COMMIT_GRAPH_WRITE <cg-two-satisfied.txt
+'
+
test_expect_success 'run --task=bogus' '
test_must_fail git maintenance run --task=bogus 2>err &&
test_i18ngrep "is not a valid task" err