diff --git a/builtin/gc.c b/builtin/gc.c
index 2ebae7bc17..286ce131a5 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1708,7 +1708,6 @@ static int get_schedule_cmd(const char **cmd, int *is_available)
return 1;
}
-MAYBE_UNUSED
static int get_random_minute(void)
{
/* Use a static value when under tests. */
@@ -1830,6 +1829,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
struct strbuf plist = STRBUF_INIT, plist2 = STRBUF_INIT;
struct stat st;
const char *cmd = "launchctl";
+ int minute = get_random_minute();
get_schedule_cmd(&cmd, NULL);
preamble = "\n"
@@ -1855,29 +1855,30 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
case SCHEDULE_HOURLY:
repeat = "\n"
"Hour%d\n"
- "Minute0\n"
+ "Minute%d\n"
"\n";
for (i = 1; i <= 23; i++)
- strbuf_addf(&plist, repeat, i);
+ strbuf_addf(&plist, repeat, i, minute);
break;
case SCHEDULE_DAILY:
repeat = "\n"
"Day%d\n"
"Hour0\n"
- "Minute0\n"
+ "Minute%d\n"
"\n";
for (i = 1; i <= 6; i++)
- strbuf_addf(&plist, repeat, i);
+ strbuf_addf(&plist, repeat, i, minute);
break;
case SCHEDULE_WEEKLY:
- strbuf_addstr(&plist,
- "\n"
- "Day0\n"
- "Hour0\n"
- "Minute0\n"
- "\n");
+ strbuf_addf(&plist,
+ "\n"
+ "Day0\n"
+ "Hour0\n"
+ "Minute%d\n"
+ "\n",
+ minute);
break;
default: