pretty: remove reencode_commit_message()
This function has only two callsites, and is a thin wrapper whose usefulness is dubious. When the caller needs to learn the log output encoding, it should be able to do so by directly calling get_log_output_encoding() and calling the underlying logmsg_reencode() with it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
87a5461fa7
commit
e297cf5aff
@ -1425,7 +1425,7 @@ static void get_commit_info(struct commit *commit,
|
|||||||
int detailed)
|
int detailed)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
const char *subject;
|
const char *subject, *encoding;
|
||||||
char *reencoded, *message;
|
char *reencoded, *message;
|
||||||
static char author_name[1024];
|
static char author_name[1024];
|
||||||
static char author_mail[1024];
|
static char author_mail[1024];
|
||||||
@ -1446,7 +1446,8 @@ static void get_commit_info(struct commit *commit,
|
|||||||
die("Cannot read commit %s",
|
die("Cannot read commit %s",
|
||||||
sha1_to_hex(commit->object.sha1));
|
sha1_to_hex(commit->object.sha1));
|
||||||
}
|
}
|
||||||
reencoded = reencode_commit_message(commit, NULL);
|
encoding = get_log_output_encoding();
|
||||||
|
reencoded = logmsg_reencode(commit, encoding);
|
||||||
message = reencoded ? reencoded : commit->buffer;
|
message = reencoded ? reencoded : commit->buffer;
|
||||||
ret->author = author_name;
|
ret->author = author_name;
|
||||||
ret->author_mail = author_mail;
|
ret->author_mail = author_mail;
|
||||||
|
2
commit.h
2
commit.h
@ -99,8 +99,6 @@ extern int has_non_ascii(const char *text);
|
|||||||
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
|
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
|
||||||
extern char *logmsg_reencode(const struct commit *commit,
|
extern char *logmsg_reencode(const struct commit *commit,
|
||||||
const char *output_encoding);
|
const char *output_encoding);
|
||||||
extern char *reencode_commit_message(const struct commit *commit,
|
|
||||||
const char **encoding_p);
|
|
||||||
extern void get_commit_format(const char *arg, struct rev_info *);
|
extern void get_commit_format(const char *arg, struct rev_info *);
|
||||||
extern const char *format_subject(struct strbuf *sb, const char *msg,
|
extern const char *format_subject(struct strbuf *sb, const char *msg,
|
||||||
const char *line_separator);
|
const char *line_separator);
|
||||||
|
13
pretty.c
13
pretty.c
@ -1341,16 +1341,6 @@ void pp_remainder(const struct pretty_print_context *pp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *reencode_commit_message(const struct commit *commit, const char **encoding_p)
|
|
||||||
{
|
|
||||||
const char *encoding;
|
|
||||||
|
|
||||||
encoding = get_log_output_encoding();
|
|
||||||
if (encoding_p)
|
|
||||||
*encoding_p = encoding;
|
|
||||||
return logmsg_reencode(commit, encoding);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pretty_print_commit(const struct pretty_print_context *pp,
|
void pretty_print_commit(const struct pretty_print_context *pp,
|
||||||
const struct commit *commit,
|
const struct commit *commit,
|
||||||
struct strbuf *sb)
|
struct strbuf *sb)
|
||||||
@ -1367,7 +1357,8 @@ void pretty_print_commit(const struct pretty_print_context *pp,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
reencoded = reencode_commit_message(commit, &encoding);
|
encoding = get_log_output_encoding();
|
||||||
|
reencoded = logmsg_reencode(commit, encoding);
|
||||||
if (reencoded) {
|
if (reencoded) {
|
||||||
msg = reencoded;
|
msg = reencoded;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user