Skip to content

Commit 0e05d53

Browse files
pks-tgitster
authored andcommitted
builtin/gc: move struct maintenance_run_opts
We're about to start using `struct maintenance_run_opts` in `maintenance_task_pack_refs()`. Move its definition up to prepare for this. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6dcffc6 commit 0e05d53

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

builtin/gc.c

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,32 @@ static void gc_config(void)
180180
git_config(git_default_config, NULL);
181181
}
182182

183-
struct maintenance_run_opts;
183+
enum schedule_priority {
184+
SCHEDULE_NONE = 0,
185+
SCHEDULE_WEEKLY = 1,
186+
SCHEDULE_DAILY = 2,
187+
SCHEDULE_HOURLY = 3,
188+
};
189+
190+
static enum schedule_priority parse_schedule(const char *value)
191+
{
192+
if (!value)
193+
return SCHEDULE_NONE;
194+
if (!strcasecmp(value, "hourly"))
195+
return SCHEDULE_HOURLY;
196+
if (!strcasecmp(value, "daily"))
197+
return SCHEDULE_DAILY;
198+
if (!strcasecmp(value, "weekly"))
199+
return SCHEDULE_WEEKLY;
200+
return SCHEDULE_NONE;
201+
}
202+
203+
struct maintenance_run_opts {
204+
int auto_flag;
205+
int quiet;
206+
enum schedule_priority schedule;
207+
};
208+
184209
static int maintenance_task_pack_refs(MAYBE_UNUSED struct maintenance_run_opts *opts)
185210
{
186211
struct child_process cmd = CHILD_PROCESS_INIT;
@@ -773,26 +798,6 @@ static const char *const builtin_maintenance_run_usage[] = {
773798
NULL
774799
};
775800

776-
enum schedule_priority {
777-
SCHEDULE_NONE = 0,
778-
SCHEDULE_WEEKLY = 1,
779-
SCHEDULE_DAILY = 2,
780-
SCHEDULE_HOURLY = 3,
781-
};
782-
783-
static enum schedule_priority parse_schedule(const char *value)
784-
{
785-
if (!value)
786-
return SCHEDULE_NONE;
787-
if (!strcasecmp(value, "hourly"))
788-
return SCHEDULE_HOURLY;
789-
if (!strcasecmp(value, "daily"))
790-
return SCHEDULE_DAILY;
791-
if (!strcasecmp(value, "weekly"))
792-
return SCHEDULE_WEEKLY;
793-
return SCHEDULE_NONE;
794-
}
795-
796801
static int maintenance_opt_schedule(const struct option *opt, const char *arg,
797802
int unset)
798803
{
@@ -809,12 +814,6 @@ static int maintenance_opt_schedule(const struct option *opt, const char *arg,
809814
return 0;
810815
}
811816

812-
struct maintenance_run_opts {
813-
int auto_flag;
814-
int quiet;
815-
enum schedule_priority schedule;
816-
};
817-
818817
/* Remember to update object flag allocation in object.h */
819818
#define SEEN (1u<<0)
820819

0 commit comments

Comments
 (0)