Skip to content

Commit

Permalink
Merge branch 'derrickstolee/gc-fix-quick'
Browse files Browse the repository at this point in the history
This backports git-for-windows#5198 to
`microsoft/git` so that v2.47.0 will have it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Oct 9, 2024
2 parents 10b13c6 + becfd0a commit 4ee891f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
7 changes: 5 additions & 2 deletions builtin/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ static const char *get_extra_launchctl_strings(void) {
* | Input | Output |
* | *cmd | return code | *out | *is_available |
* +-------+-------------+-------------------+---------------+
* | "foo" | false | NULL | (unchanged) |
* | "foo" | false | "foo" (allocated) | (unchanged) |
* +-------+-------------+-------------------+---------------+
*
* GIT_TEST_MAINT_SCHEDULER set to “foo:./mock_foo.sh,bar:./mock_bar.sh”
Expand All @@ -1871,8 +1871,11 @@ static int get_schedule_cmd(const char *cmd, int *is_available, char **out)
struct string_list_item *item;
struct string_list list = STRING_LIST_INIT_NODUP;

if (!testing)
if (!testing) {
if (out)
*out = xstrdup(cmd);
return 0;
}

if (is_available)
*is_available = 0;
Expand Down
16 changes: 16 additions & 0 deletions t/t7900-maintenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,22 @@ test_expect_success !MINGW 'register and unregister with regex metacharacters' '
maintenance.repo "$(pwd)/$META"
'

test_expect_success !MINGW,!DARWIN 'start without GIT_TEST_MAINT_SCHEDULER' '
test_when_finished "rm -rf crontab.log script repo" &&
mkdir script &&
write_script script/crontab <<-EOF &&
echo "\$*" >>"$(pwd)"/crontab.log
EOF
git init repo &&
(
cd repo &&
sane_unset GIT_TEST_MAINT_SCHEDULER &&
PATH="$(pwd)/../script:$PATH" git maintenance start --scheduler=crontab
) &&
test_grep -- -l crontab.log &&
test_grep -- git_cron_edit_tmp crontab.log
'

test_expect_success 'start --scheduler=<scheduler>' '
test_expect_code 129 git maintenance start --scheduler=foo 2>err &&
test_grep "unrecognized --scheduler argument" err &&
Expand Down
6 changes: 6 additions & 0 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,12 @@ case $uname_s in
test_set_prereq GREP_STRIPS_CR
test_set_prereq WINDOWS
;;
*Darwin*)
test_set_prereq POSIXPERM
test_set_prereq BSLASHPSPEC
test_set_prereq EXECKEEPSPID
test_set_prereq DARWIN
;;
*)
test_set_prereq POSIXPERM
test_set_prereq BSLASHPSPEC
Expand Down

0 comments on commit 4ee891f

Please sign in to comment.