2007-01-11 10:47:48 +00:00
|
|
|
#ifndef REFLOG_WALK_H
|
|
|
|
#define REFLOG_WALK_H
|
|
|
|
|
2009-03-20 06:00:43 +00:00
|
|
|
#include "cache.h"
|
|
|
|
|
2009-10-19 15:48:10 +00:00
|
|
|
struct reflog_walk_info;
|
|
|
|
|
2014-08-31 20:11:31 +00:00
|
|
|
extern void init_reflog_walk(struct reflog_walk_info **info);
|
2007-07-23 23:39:50 +00:00
|
|
|
extern int add_reflog_for_walk(struct reflog_walk_info *info,
|
2007-01-11 10:47:48 +00:00
|
|
|
struct commit *commit, const char *name);
|
|
|
|
extern void fake_reflog_parent(struct reflog_walk_info *info,
|
|
|
|
struct commit *commit);
|
2009-03-20 06:00:43 +00:00
|
|
|
extern void show_reflog_message(struct reflog_walk_info *info, int,
|
convert "enum date_mode" into a struct
In preparation for adding date modes that may carry extra
information beyond the mode itself, this patch converts the
date_mode enum into a struct.
Most of the conversion is fairly straightforward; we pass
the struct as a pointer and dereference the type field where
necessary. Locations that declare a date_mode can use a "{}"
constructor. However, the tricky case is where we use the
enum labels as constants, like:
show_date(t, tz, DATE_NORMAL);
Ideally we could say:
show_date(t, tz, &{ DATE_NORMAL });
but of course C does not allow that. Likewise, we cannot
cast the constant to a struct, because we need to pass an
actual address. Our options are basically:
1. Manually add a "struct date_mode d = { DATE_NORMAL }"
definition to each caller, and pass "&d". This makes
the callers uglier, because they sometimes do not even
have their own scope (e.g., they are inside a switch
statement).
2. Provide a pre-made global "date_normal" struct that can
be passed by address. We'd also need "date_rfc2822",
"date_iso8601", and so forth. But at least the ugliness
is defined in one place.
3. Provide a wrapper that generates the correct struct on
the fly. The big downside is that we end up pointing to
a single global, which makes our wrapper non-reentrant.
But show_date is already not reentrant, so it does not
matter.
This patch implements 3, along with a minor macro to keep
the size of the callers sane.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-25 16:55:02 +00:00
|
|
|
const struct date_mode *, int force_date);
|
2009-10-19 15:48:10 +00:00
|
|
|
extern void get_reflog_message(struct strbuf *sb,
|
|
|
|
struct reflog_walk_info *reflog_info);
|
2011-12-16 11:40:24 +00:00
|
|
|
extern const char *get_reflog_ident(struct reflog_walk_info *reflog_info);
|
2009-10-19 15:48:10 +00:00
|
|
|
extern void get_reflog_selector(struct strbuf *sb,
|
|
|
|
struct reflog_walk_info *reflog_info,
|
convert "enum date_mode" into a struct
In preparation for adding date modes that may carry extra
information beyond the mode itself, this patch converts the
date_mode enum into a struct.
Most of the conversion is fairly straightforward; we pass
the struct as a pointer and dereference the type field where
necessary. Locations that declare a date_mode can use a "{}"
constructor. However, the tricky case is where we use the
enum labels as constants, like:
show_date(t, tz, DATE_NORMAL);
Ideally we could say:
show_date(t, tz, &{ DATE_NORMAL });
but of course C does not allow that. Likewise, we cannot
cast the constant to a struct, because we need to pass an
actual address. Our options are basically:
1. Manually add a "struct date_mode d = { DATE_NORMAL }"
definition to each caller, and pass "&d". This makes
the callers uglier, because they sometimes do not even
have their own scope (e.g., they are inside a switch
statement).
2. Provide a pre-made global "date_normal" struct that can
be passed by address. We'd also need "date_rfc2822",
"date_iso8601", and so forth. But at least the ugliness
is defined in one place.
3. Provide a wrapper that generates the correct struct on
the fly. The big downside is that we end up pointing to
a single global, which makes our wrapper non-reentrant.
But show_date is already not reentrant, so it does not
matter.
This patch implements 3, along with a minor macro to keep
the size of the callers sane.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-25 16:55:02 +00:00
|
|
|
const struct date_mode *dmode, int force_date,
|
2009-10-19 15:48:10 +00:00
|
|
|
int shorten);
|
2007-01-11 10:47:48 +00:00
|
|
|
|
|
|
|
#endif
|