Skip to content

Commit 4ee891f

Browse files
committed
Merge branch 'derrickstolee/gc-fix-quick'
This backports git-for-windows#5198 to `microsoft/git` so that v2.47.0 will have it. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 10b13c6 + becfd0a commit 4ee891f

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

builtin/gc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ static const char *get_extra_launchctl_strings(void) {
18531853
* | Input | Output |
18541854
* | *cmd | return code | *out | *is_available |
18551855
* +-------+-------------+-------------------+---------------+
1856-
* | "foo" | false | NULL | (unchanged) |
1856+
* | "foo" | false | "foo" (allocated) | (unchanged) |
18571857
* +-------+-------------+-------------------+---------------+
18581858
*
18591859
* GIT_TEST_MAINT_SCHEDULER set to “foo:./mock_foo.sh,bar:./mock_bar.sh”
@@ -1871,8 +1871,11 @@ static int get_schedule_cmd(const char *cmd, int *is_available, char **out)
18711871
struct string_list_item *item;
18721872
struct string_list list = STRING_LIST_INIT_NODUP;
18731873

1874-
if (!testing)
1874+
if (!testing) {
1875+
if (out)
1876+
*out = xstrdup(cmd);
18751877
return 0;
1878+
}
18761879

18771880
if (is_available)
18781881
*is_available = 0;

t/t7900-maintenance.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,22 @@ test_expect_success !MINGW 'register and unregister with regex metacharacters' '
646646
maintenance.repo "$(pwd)/$META"
647647
'
648648

649+
test_expect_success !MINGW,!DARWIN 'start without GIT_TEST_MAINT_SCHEDULER' '
650+
test_when_finished "rm -rf crontab.log script repo" &&
651+
mkdir script &&
652+
write_script script/crontab <<-EOF &&
653+
echo "\$*" >>"$(pwd)"/crontab.log
654+
EOF
655+
git init repo &&
656+
(
657+
cd repo &&
658+
sane_unset GIT_TEST_MAINT_SCHEDULER &&
659+
PATH="$(pwd)/../script:$PATH" git maintenance start --scheduler=crontab
660+
) &&
661+
test_grep -- -l crontab.log &&
662+
test_grep -- git_cron_edit_tmp crontab.log
663+
'
664+
649665
test_expect_success 'start --scheduler=<scheduler>' '
650666
test_expect_code 129 git maintenance start --scheduler=foo 2>err &&
651667
test_grep "unrecognized --scheduler argument" err &&

t/test-lib.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,12 @@ case $uname_s in
17381738
test_set_prereq GREP_STRIPS_CR
17391739
test_set_prereq WINDOWS
17401740
;;
1741+
*Darwin*)
1742+
test_set_prereq POSIXPERM
1743+
test_set_prereq BSLASHPSPEC
1744+
test_set_prereq EXECKEEPSPID
1745+
test_set_prereq DARWIN
1746+
;;
17411747
*)
17421748
test_set_prereq POSIXPERM
17431749
test_set_prereq BSLASHPSPEC

0 commit comments

Comments
 (0)