mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Export format_commit_message()
Drop the parameter "msg" of format_commit_message() (as it can be inferred from the parameter "commit"), add a parameter "template" in order to avoid accessing the static variable user_format directly and export the result. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1e61b7640d
commit
7b95089c0f
9
commit.c
9
commit.c
|
@ -787,8 +787,8 @@ static void fill_person(struct interp *table, const char *msg, int len)
|
||||||
interp_set_entry(table, 6, show_date(date, tz, DATE_ISO8601));
|
interp_set_entry(table, 6, show_date(date, tz, DATE_ISO8601));
|
||||||
}
|
}
|
||||||
|
|
||||||
static long format_commit_message(const struct commit *commit,
|
long format_commit_message(const struct commit *commit, const void *format,
|
||||||
const char *msg, char **buf_p, unsigned long *space_p)
|
char **buf_p, unsigned long *space_p)
|
||||||
{
|
{
|
||||||
struct interp table[] = {
|
struct interp table[] = {
|
||||||
{ "%H" }, /* commit hash */
|
{ "%H" }, /* commit hash */
|
||||||
|
@ -843,6 +843,7 @@ static long format_commit_message(const struct commit *commit,
|
||||||
char parents[1024];
|
char parents[1024];
|
||||||
int i;
|
int i;
|
||||||
enum { HEADER, SUBJECT, BODY } state;
|
enum { HEADER, SUBJECT, BODY } state;
|
||||||
|
const char *msg = commit->buffer;
|
||||||
|
|
||||||
if (ILEFT_RIGHT + 1 != ARRAY_SIZE(table))
|
if (ILEFT_RIGHT + 1 != ARRAY_SIZE(table))
|
||||||
die("invalid interp table!");
|
die("invalid interp table!");
|
||||||
|
@ -924,7 +925,7 @@ static long format_commit_message(const struct commit *commit,
|
||||||
char *buf = *buf_p;
|
char *buf = *buf_p;
|
||||||
unsigned long space = *space_p;
|
unsigned long space = *space_p;
|
||||||
|
|
||||||
space = interpolate(buf, space, user_format,
|
space = interpolate(buf, space, format,
|
||||||
table, ARRAY_SIZE(table));
|
table, ARRAY_SIZE(table));
|
||||||
if (!space)
|
if (!space)
|
||||||
break;
|
break;
|
||||||
|
@ -1165,7 +1166,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (fmt == CMIT_FMT_USERFORMAT)
|
if (fmt == CMIT_FMT_USERFORMAT)
|
||||||
return format_commit_message(commit, msg, buf_p, space_p);
|
return format_commit_message(commit, user_format, buf_p, space_p);
|
||||||
|
|
||||||
encoding = (git_log_output_encoding
|
encoding = (git_log_output_encoding
|
||||||
? git_log_output_encoding
|
? git_log_output_encoding
|
||||||
|
|
1
commit.h
1
commit.h
|
@ -61,6 +61,7 @@ enum cmit_fmt {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern enum cmit_fmt get_commit_format(const char *arg);
|
extern enum cmit_fmt get_commit_format(const char *arg);
|
||||||
|
extern long format_commit_message(const struct commit *commit, const void *template, char **buf_p, unsigned long *space_p);
|
||||||
extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char **buf_p, unsigned long *space_p, int abbrev, const char *subject, const char *after_subject, enum date_mode dmode);
|
extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char **buf_p, unsigned long *space_p, int abbrev, const char *subject, const char *after_subject, enum date_mode dmode);
|
||||||
|
|
||||||
/** Removes the first commit from a list sorted by date, and adds all
|
/** Removes the first commit from a list sorted by date, and adds all
|
||||||
|
|
Loading…
Reference in a new issue