From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 1/2] t0601: merge tests for auto-packing of refs
Date: Mon, 2 Sep 2024 15:48:35 +0200 [thread overview]
Message-ID: <3a8063e8b2c05315a5cbe8159a6acae43c12d39c.1725280479.git.ps@pks.im> (raw)
In-Reply-To: <cover.1725280479.git.ps@pks.im>
We have two tests in t0601 which exercise the same underlying logic,
once via `git pack-refs --auto` and once via `git maintenance run
--auto`. Merge these two tests into one such that it becomes easier to
extend test coverage for both commands at the same time.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t0601-reffiles-pack-refs.sh | 36 +++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh
index 60a544b8ee8..ed9652bb829 100755
--- a/t/t0601-reffiles-pack-refs.sh
+++ b/t/t0601-reffiles-pack-refs.sh
@@ -161,13 +161,6 @@ test_expect_success 'test --exclude takes precedence over --include' '
git pack-refs --include "refs/heads/pack*" --exclude "refs/heads/pack*" &&
test -f .git/refs/heads/dont_pack5'
-test_expect_success '--auto packs and prunes refs as usual' '
- git branch auto &&
- test_path_is_file .git/refs/heads/auto &&
- git pack-refs --auto --all &&
- test_path_is_missing .git/refs/heads/auto
-'
-
test_expect_success 'see if up-to-date packed refs are preserved' '
git branch q &&
git pack-refs --all --prune &&
@@ -367,14 +360,25 @@ test_expect_success 'pack-refs does not drop broken refs during deletion' '
test_cmp expect actual
'
-test_expect_success 'maintenance --auto unconditionally packs loose refs' '
- git update-ref refs/heads/something HEAD &&
- test_path_is_file .git/refs/heads/something &&
- git rev-parse refs/heads/something >expect &&
- git maintenance run --task=pack-refs --auto &&
- test_path_is_missing .git/refs/heads/something &&
- git rev-parse refs/heads/something >actual &&
- test_cmp expect actual
-'
+for command in "git pack-refs --all --auto" "git maintenance run --task=pack-refs --auto"
+do
+ test_expect_success "$command unconditionally packs loose refs" '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ git config set maintenance.auto false &&
+ test_commit initial &&
+
+ git update-ref refs/heads/something HEAD &&
+ test_path_is_file .git/refs/heads/something &&
+ git rev-parse refs/heads/something >expect &&
+ $command &&
+ test_path_is_missing .git/refs/heads/something &&
+ git rev-parse refs/heads/something >actual &&
+ test_cmp expect actual
+ )
+ '
+done
test_done
--
2.46.0.421.g159f2d50e7.dirty
next prev parent reply other threads:[~2024-09-02 13:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 13:48 [PATCH 0/2] refs/files: use heuristic to decide whether to repack with `--auto` Patrick Steinhardt
2024-09-02 13:48 ` Patrick Steinhardt [this message]
2024-09-02 13:48 ` [PATCH 2/2] " Patrick Steinhardt
2024-09-03 9:00 ` karthik nayak
2024-09-03 9:23 ` Patrick Steinhardt
2024-09-03 18:23 ` Junio C Hamano
2024-09-04 7:42 ` Patrick Steinhardt
2024-09-04 16:15 ` Junio C Hamano
2024-09-04 8:49 ` Patrick Steinhardt
2024-09-05 8:44 ` karthik nayak
2024-09-04 8:52 ` [PATCH v2 0/3] refs/files: use heuristics " Patrick Steinhardt
2024-09-04 8:53 ` [PATCH v2 1/3] wrapper: introduce `log2u()` Patrick Steinhardt
2024-09-04 8:53 ` [PATCH v2 2/3] t0601: merge tests for auto-packing of refs Patrick Steinhardt
2024-09-04 8:53 ` [PATCH v2 3/3] refs/files: use heuristic to decide whether to repack with `--auto` Patrick Steinhardt
2024-09-04 15:24 ` Junio C Hamano
2024-09-05 9:58 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a8063e8b2c05315a5cbe8159a6acae43c12d39c.1725280479.git.ps@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).