Git fork

Merge branch 'ps/maintenance-start-crash-fix'

"git maintenance start" crashed due to an uninitialized variable
reference, which has been corrected.

* ps/maintenance-start-crash-fix:
builtin/gc: fix crash when running `git maintenance start`

+21 -2
+5 -2
builtin/gc.c
··· 1832 1832 * | Input | Output | 1833 1833 * | *cmd | return code | *out | *is_available | 1834 1834 * +-------+-------------+-------------------+---------------+ 1835 - * | "foo" | false | NULL | (unchanged) | 1835 + * | "foo" | false | "foo" (allocated) | (unchanged) | 1836 1836 * +-------+-------------+-------------------+---------------+ 1837 1837 * 1838 1838 * GIT_TEST_MAINT_SCHEDULER set to “foo:./mock_foo.sh,bar:./mock_bar.sh” ··· 1850 1850 struct string_list_item *item; 1851 1851 struct string_list list = STRING_LIST_INIT_NODUP; 1852 1852 1853 - if (!testing) 1853 + if (!testing) { 1854 + if (out) 1855 + *out = xstrdup(cmd); 1854 1856 return 0; 1857 + } 1855 1858 1856 1859 if (is_available) 1857 1860 *is_available = 0;
+16
t/t7900-maintenance.sh
··· 646 646 maintenance.repo "$(pwd)/$META" 647 647 ' 648 648 649 + test_expect_success 'start without GIT_TEST_MAINT_SCHEDULER' ' 650 + test_when_finished "rm -rf systemctl.log script repo" && 651 + mkdir script && 652 + write_script script/systemctl <<-\EOF && 653 + echo "$*" >>../systemctl.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=systemd 660 + ) && 661 + test_grep -- "--user list-timers" systemctl.log && 662 + test_grep -- "enable --now git-maintenance@" systemctl.log 663 + ' 664 + 649 665 test_expect_success 'start --scheduler=<scheduler>' ' 650 666 test_expect_code 129 git maintenance start --scheduler=foo 2>err && 651 667 test_grep "unrecognized --scheduler argument" err &&