Hello, Please find hereafter my updated patchset to add support for systemd timers on Linux for the `git maintenance start` command. The goal of this re-roll is to address Derrick’s remarks [1] Namely: * Get rid of the #ifdef around real_is_systemd_timer_available * Fix the whitespace issue in systemd_timer_setup_units [1] https://lore.kernel.org/git/44904983-a6a8-d72f-24db-50bf112c585b@xxxxxxxxx/ The patches are: * cache.h: Introduce a generic "xdg_config_home_for(…)" function This patch introduces a function to compute configuration files paths inside $XDG_CONFIG_HOME. This patch is unchanged compared to its previous version. * maintenance: `git maintenance run` learned `--scheduler=<scheduler>` This patch adds a new parameter to the `git maintenance run` to let the user choose a scheduler. This patch is unchanged compared to its previous version. * maintenance: add support for systemd timers on Linux This patch implements the support of systemd timers on top of crontab scheduler on Linux systems. * The whitespace nit has been fixed with `git rebase --whitespace=fix` * The #ifdef around real_is_systemd_timer_available has been dropped so that its code is compiled on every platform. This means that: * The availability of `launchctl` and `schtasks` are completely determined at compilation time by the platform. * The availability of `cron` and `systemd timers` are fully determined at runtime even if today only Linux might have systemd. Best wishes, Lénaïc. Lénaïc Huard (3): cache.h: Introduce a generic "xdg_config_home_for(…)" function maintenance: `git maintenance run` learned `--scheduler=<scheduler>` maintenance: add support for systemd timers on Linux Documentation/git-maintenance.txt | 57 +++ builtin/gc.c | 581 ++++++++++++++++++++++++++---- cache.h | 7 + path.c | 13 +- t/t7900-maintenance.sh | 110 +++++- 5 files changed, 690 insertions(+), 78 deletions(-) Diff-intervalle contre v8 : -: ---------- > 1: 1639bd151c cache.h: Introduce a generic "xdg_config_home_for(…)" function -: ---------- > 2: ea5568269c maintenance: `git maintenance run` learned `--scheduler=<scheduler>` 1: faf56c078f ! 3: 8c25ebd3be maintenance: add support for systemd timers on Linux @@ builtin/gc.c: static int crontab_update_schedule(int run_maintenance, int fd) return result; } -+#ifdef __linux__ -+ +static int real_is_systemd_timer_available(void) +{ + struct child_process child = CHILD_PROCESS_INIT; @@ builtin/gc.c: static int crontab_update_schedule(int run_maintenance, int fd) + return 1; +} + -+#else -+ -+static int real_is_systemd_timer_available(void) -+{ -+ return 0; -+} -+ -+#endif -+ +static int is_systemd_timer_available(void) +{ + const char *cmd = "systemctl"; @@ builtin/gc.c: static int crontab_update_schedule(int run_maintenance, int fd) + const char *exec_path = git_exec_path(); + + int ret = systemd_timer_write_unit_templates(exec_path) || -+ systemd_timer_enable_unit(1, SCHEDULE_HOURLY) || -+ systemd_timer_enable_unit(1, SCHEDULE_DAILY) || -+ systemd_timer_enable_unit(1, SCHEDULE_WEEKLY); ++ systemd_timer_enable_unit(1, SCHEDULE_HOURLY) || ++ systemd_timer_enable_unit(1, SCHEDULE_DAILY) || ++ systemd_timer_enable_unit(1, SCHEDULE_WEEKLY); + if (ret) + systemd_timer_delete_units(); + return ret; -- 2.33.0