The sixteenth batch
[git/gitster.git] / reflog.h
blob74b3f3c4f0acf2102e274581c3c3444f8de2b2fe
1 #ifndef REFLOG_H
2 #define REFLOG_H
3 #include "refs.h"
5 #define REFLOG_EXPIRE_TOTAL (1 << 0)
6 #define REFLOG_EXPIRE_UNREACH (1 << 1)
8 struct reflog_expire_entry_option {
9 struct reflog_expire_entry_option *next;
10 timestamp_t expire_total;
11 timestamp_t expire_unreachable;
12 char pattern[FLEX_ARRAY];
15 struct reflog_expire_options {
16 struct reflog_expire_entry_option *entries, **entries_tail;
17 int stalefix;
18 int explicit_expiry;
19 timestamp_t default_expire_total;
20 timestamp_t expire_total;
21 timestamp_t default_expire_unreachable;
22 timestamp_t expire_unreachable;
23 int recno;
25 #define REFLOG_EXPIRE_OPTIONS_INIT(now) { \
26 .default_expire_total = now - 30 * 24 * 3600, \
27 .default_expire_unreachable = now - 90 * 24 * 3600, \
31 * Parse the reflog expire configuration. This should be used with
32 * `repo_config()`.
34 int reflog_expire_config(const char *var, const char *value,
35 const struct config_context *ctx, void *cb);
37 void reflog_clear_expire_config(struct reflog_expire_options *opts);
40 * Adapt the options so that they apply to the given refname. This applies any
41 * per-reference reflog expiry configuration that may exist to the options.
43 void reflog_expire_options_set_refname(struct reflog_expire_options *cb,
44 const char *refname);
46 struct expire_reflog_policy_cb {
47 enum {
48 UE_NORMAL,
49 UE_ALWAYS,
50 UE_HEAD
51 } unreachable_expire_kind;
52 struct commit_list *mark_list;
53 unsigned long mark_limit;
54 struct reflog_expire_options opts;
55 struct commit *tip_commit;
56 struct commit_list *tips;
57 unsigned int dry_run:1;
60 int reflog_delete(const char *rev, enum expire_reflog_flags flags,
61 int verbose);
62 void reflog_expiry_cleanup(void *cb_data);
63 void reflog_expiry_prepare(const char *refname, const struct object_id *oid,
64 void *cb_data);
65 int should_expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
66 const char *email, timestamp_t timestamp, int tz,
67 const char *message, void *cb_data);
68 int count_reflog_ent(struct object_id *ooid, struct object_id *noid,
69 const char *email, timestamp_t timestamp, int tz,
70 const char *message, void *cb_data);
71 int should_expire_reflog_ent_verbose(struct object_id *ooid,
72 struct object_id *noid,
73 const char *email,
74 timestamp_t timestamp, int tz,
75 const char *message, void *cb_data);
76 #endif /* REFLOG_H */