Rename expire_reflog_cb to expire_reflog_policy_cb

This is the first step towards separating the data needed by the policy code from the data needed by the reflog expiration machinery. (In a moment we will add a *new* "struct expire_reflog_cb" for the use of expire_reflog() itself, then move fields selectively from expire_reflog_policy_cb to expire_reflog_cb.) Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Dec 12, 2014 at 09:56 UTC ea7b4f6d3368654b1bd751193eaad4eca71991e4
1 file changed +10 -9
builtin/reflog.c
+10 -9
@@ -35,7 +35,7 @@ struct cmd_reflog_expire_cb {
35 int recno;
36 };
37
38 -struct expire_reflog_cb {
38 +struct expire_reflog_policy_cb {
39 FILE *newlog;
40 enum {
41 UE_NORMAL,
@@ -225,7 +225,7 @@ static int keep_entry(struct commit **it, unsigned char *sha1)
225 * the expire_limit and queue them back, so that the caller can call
226 * us again to restart the traversal with longer expire_limit.
227 */
228 -static void mark_reachable(struct expire_reflog_cb *cb)
228 +static void mark_reachable(struct expire_reflog_policy_cb *cb)
229 {
230 struct commit *commit;
231 struct commit_list *pending;
@@ -264,7 +264,7 @@ static void mark_reachable(struct expire_reflog_cb *cb)
264 cb->mark_list = leftover;
265 }
266
267 -static int unreachable(struct expire_reflog_cb *cb, struct commit *commit, unsigned char *sha1)
267 +static int unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit, unsigned char *sha1)
268 {
269 /*
270 * We may or may not have the commit yet - if not, look it
@@ -300,7 +300,7 @@ static int should_expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
300 const char *email, unsigned long timestamp, int tz,
301 const char *message, void *cb_data)
302 {
303 - struct expire_reflog_cb *cb = cb_data;
303 + struct expire_reflog_policy_cb *cb = cb_data;
304 struct commit *old, *new;
305
306 if (timestamp < cb->cmd->expire_total)
@@ -328,7 +328,7 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
328 const char *email, unsigned long timestamp, int tz,
329 const char *message, void *cb_data)
330 {
331 - struct expire_reflog_cb *cb = cb_data;
331 + struct expire_reflog_policy_cb *cb = cb_data;
332
333 if (cb->cmd->rewrite)
334 osha1 = cb->last_kept_sha1;
@@ -355,7 +355,8 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
355 return 0;
356 }
357
358 -static int push_tip_to_list(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
358 +static int push_tip_to_list(const char *refname, const unsigned char *sha1,
359 + int flags, void *cb_data)
360 {
361 struct commit_list **list = cb_data;
362 struct commit *tip_commit;
@@ -370,7 +371,7 @@ static int push_tip_to_list(const char *refname, const unsigned char *sha1, int
371
372 static void reflog_expiry_prepare(const char *refname,
373 const unsigned char *sha1,
373 - struct expire_reflog_cb *cb)
374 + struct expire_reflog_policy_cb *cb)
375 {
376 if (!cb->cmd->expire_unreachable || !strcmp(refname, "HEAD")) {
377 cb->tip_commit = NULL;
@@ -402,7 +403,7 @@ static void reflog_expiry_prepare(const char *refname,
403 }
404 }
405
405 -static void reflog_expiry_cleanup(struct expire_reflog_cb *cb)
406 +static void reflog_expiry_cleanup(struct expire_reflog_policy_cb *cb)
407 {
408 if (cb->unreachable_expire_kind != UE_ALWAYS) {
409 if (cb->unreachable_expire_kind == UE_HEAD) {
@@ -420,7 +421,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
421 unsigned int flags, struct cmd_reflog_expire_cb *cmd)
422 {
423 static struct lock_file reflog_lock;
423 - struct expire_reflog_cb cb;
424 + struct expire_reflog_policy_cb cb;
425 struct ref_lock *lock;
426 char *log_file;
427 int status = 0;