diff mbox series

[v3,6/8] reflog tests: assert lack of early exit with expiry="never"

Message ID 20190315155959.12390-7-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series gc: minor code cleanup + contention fixes | expand

Commit Message

Ævar Arnfjörð Bjarmason March 15, 2019, 3:59 p.m. UTC
When gc.reflogExpire and gc.reflogExpireUnreachable are set to "never"
and --stale-fix isn't in effect (covered by the first part of the "if"
statement being modified here) we *could* exit early without
pointlessly looping over all the reflogs.

However, as an earlier change to add a test for the "points nowhere"
warning shows even in such a mode we might want to print out a
warning.

So while it's conceivable to implement this, I don't think it's worth
it. It's going to be too easy to inadvertently add some flag that'll
make the expiry happen anyway, and even with "never" we'd like to see
all the lines we're going to keep.

So let's assert that we're going to loop over all the references even
when this configuration is in effect.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t1410-reflog.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jeff King March 19, 2019, 6:20 a.m. UTC | #1
On Fri, Mar 15, 2019 at 04:59:57PM +0100, Ævar Arnfjörð Bjarmason wrote:

> When gc.reflogExpire and gc.reflogExpireUnreachable are set to "never"
> and --stale-fix isn't in effect (covered by the first part of the "if"
> statement being modified here) we *could* exit early without
> pointlessly looping over all the reflogs.

Er, which "if" statement are we modifying here? :)

I assume this is leftover from the earlier attempt which actually did
modify it.

-Peff
diff mbox series

Patch

diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index e8f8ac97856..79f731db37c 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -235,7 +235,9 @@  test_expect_success 'gc.reflogexpire=never' '
 	test_config gc.reflogexpire never &&
 	test_config gc.reflogexpireunreachable never &&
 
-	git reflog expire --verbose --all &&
+	git reflog expire --verbose --all >output &&
+	test_line_count = 9 output &&
+
 	git reflog refs/heads/master >output &&
 	test_line_count = 4 output
 '