Subject: Re: What's cooking in git.git (Jan 2021, #02; Fri, 8)

From: Emily Shaffer <[email-masked]>
Date: Thu, 14 Jan 2021 15:06:39 -0800

On Fri, Jan 08, 2021 at 11:22:23AM -0800, Junio C Hamano wrote:
> * ds/maintenance-part-4 (2021-01-05) 4 commits
>   (merged to 'next' on 2021-01-08 at 1f98c859ea)
>  + maintenance: use Windows scheduled tasks
>  + maintenance: use launchctl on macOS
>  + maintenance: include 'cron' details in docs
>  + maintenance: extract platform-specific scheduling
> 
>  Follow-up on the "maintenance part-3" which introduced scheduled
>  maintenance tasks to support platforms whose native scheduling
>  methods are not 'cron'.
> 
>  Will merge to 'master'.

This series again has troubles running inside a directory with regex
metachars in the path. Courtesy of Jonathan Nieder, I think this fix
matches the intent a little better; but if we don't like this, the same
lines could be diffed just to add --fixed-value instead.

Before this patch, the test said "Is there something configured in
maintenance.repo that looks like $PWD?" and after this patch, the test
says, "Does the config in maintenance.repo look like $PWD?" - so it is
not quite semantically identical but I think may be clearer.

 - Emily

-- >8 --
Subject: [PATCH] maintenace: explicitly test value of maintenance.repo

Make t7900-maintenance.sh easier to debug by printing and checking the
value of maintenance.repo rather than using a search string. Since only
one maintenance.repo is configured, this is fine; in the event that
multiple maintenance.repo are configured during the test, instead the
directory under test should be provided along with '--fixed-value'.

Signed-off-by: Emily Shaffer <[email-masked]>
---
 t/t7900-maintenance.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 2e0c8a4c31..0edad63227 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -487,7 +487,9 @@ test_expect_success 'start and stop macOS maintenance' '
 	GIT_TEST_MAINT_SCHEDULER=launchctl:./print-args git maintenance start &&
 
 	# start registers the repo
-	git config --get --global maintenance.repo "$(pwd)" &&
+	pwd >expect &&
+	git config --get --global maintenance.repo >actual &&
+	test_cmp expect actual &&
 
 	ls "$HOME/Library/LaunchAgents" >actual &&
 	cat >expect <<-\EOF &&
@@ -512,7 +514,9 @@ test_expect_success 'start and stop macOS maintenance' '
 	GIT_TEST_MAINT_SCHEDULER=launchctl:./print-args git maintenance stop &&
 
 	# stop does not unregister the repo
-	git config --get --global maintenance.repo "$(pwd)" &&
+	pwd >expect &&
+	git config --get --global maintenance.repo >actual &&
+	test_cmp expect actual &&
 
 	printf "bootout gui/[UID] $pfx/Library/LaunchAgents/org.git-scm.git.%s.plist\n" \
 		hourly daily weekly >expect &&
@@ -538,7 +542,9 @@ test_expect_success 'start and stop Windows maintenance' '
 	GIT_TEST_MAINT_SCHEDULER="schtasks:./print-args" git maintenance start &&
 
 	# start registers the repo
-	git config --get --global maintenance.repo "$(pwd)" &&
+	pwd >expect &&
+	git config --get --global maintenance.repo >actual &&
+	test_cmp expect actual &&
 
 	for frequency in hourly daily weekly
 	do
@@ -551,7 +557,9 @@ test_expect_success 'start and stop Windows maintenance' '
 	GIT_TEST_MAINT_SCHEDULER="schtasks:./print-args" git maintenance stop &&
 
 	# stop does not unregister the repo
-	git config --get --global maintenance.repo "$(pwd)" &&
+	pwd >expect &&
+	git config --get --global maintenance.repo >actual &&
+	test_cmp expect actual &&
 
 	printf "/delete /tn Git Maintenance (%s) /f\n" \
 		hourly daily weekly >expect &&
-- 
2.29.2.490.gc7ae633391