63
NULL
64
};
65
66
-static timestamp_t default_reflog_expire;
67
-static timestamp_t default_reflog_expire_unreachable;
68
-
66
struct worktree_reflogs {
67
struct worktree *worktree;
68
struct string_list reflogs;
119
static int reflog_expire_config(const char *var, const char *value,
120
const struct config_context *ctx, void *cb)
121
{
122
+ struct reflog_expire_options *opts = cb;
123
const char *pattern, *key;
124
size_t pattern_len;
125
timestamp_t expire;
143
if (!pattern) {
144
switch (slot) {
145
case EXPIRE_TOTAL:
148
- default_reflog_expire = expire;
146
+ opts->default_expire_total = expire;
147
break;
148
case EXPIRE_UNREACH:
151
- default_reflog_expire_unreachable = expire;
149
+ opts->default_expire_unreachable = expire;
150
break;
151
}
152
return 0;
196
197
/* Nothing matched -- use the default value */
198
if (!(cb->explicit_expiry & EXPIRE_TOTAL))
201
- cb->expire_total = default_reflog_expire;
199
+ cb->expire_total = cb->default_expire_total;
200
if (!(cb->explicit_expiry & EXPIRE_UNREACH))
203
- cb->expire_unreachable = default_reflog_expire_unreachable;
201
+ cb->expire_unreachable = cb->default_expire_unreachable;
202
}
203
204
static int expire_unreachable_callback(const struct option *opt,
274
static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
275
struct repository *repo UNUSED)
276
{
279
- struct reflog_expire_options opts = { 0 };
277
timestamp_t now = time(NULL);
278
+ struct reflog_expire_options opts = REFLOG_EXPIRE_OPTIONS_INIT(now);
279
int i, status, do_all, single_worktree = 0;
280
unsigned int flags = 0;
281
int verbose = 0;
306
OPT_END()
307
};
308
311
- default_reflog_expire_unreachable = now - 30 * 24 * 3600;
312
- default_reflog_expire = now - 90 * 24 * 3600;
313
- git_config(reflog_expire_config, NULL);
309
+ git_config(reflog_expire_config, &opts);
310
311
save_commit_buffer = 0;
312
do_all = status = 0;
313
318
- opts.explicit_expiry = 0;
319
- opts.expire_total = default_reflog_expire;
320
- opts.expire_unreachable = default_reflog_expire_unreachable;
321
-
314
argc = parse_options(argc, argv, prefix, options, reflog_expire_usage, 0);
315
316
if (verbose)