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>
Junio C Hamano committed
Oct 17, 2012 at 17:12 UTC
e297cf5aff0264c16b6c325c0beab71bc04cd496
3 files changed
+5
-15
builtin/blame.c
+3
-2
@@ -1425,7 +1425,7 @@ static void get_commit_info(struct commit *commit,
1425
int detailed)
1426
{
1427
int len;
1428
- const char *subject;
1428
+ const char *subject, *encoding;
1429
char *reencoded, *message;
1430
static char author_name[1024];
1431
static char author_mail[1024];
@@ -1446,7 +1446,8 @@ static void get_commit_info(struct commit *commit,
1446
die("Cannot read commit %s",
1447
sha1_to_hex(commit->object.sha1));
1448
}
1449
- reencoded = reencode_commit_message(commit, NULL);
1449
+ encoding = get_log_output_encoding();
1450
+ reencoded = logmsg_reencode(commit, encoding);
1451
message = reencoded ? reencoded : commit->buffer;
1452
ret->author = author_name;
1453
ret->author_mail = author_mail;
commit.h
-2
@@ -99,8 +99,6 @@ extern int has_non_ascii(const char *text);
99
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
100
extern char *logmsg_reencode(const struct commit *commit,
101
const char *output_encoding);
102
-extern char *reencode_commit_message(const struct commit *commit,
103
- const char **encoding_p);
102
extern void get_commit_format(const char *arg, struct rev_info *);
103
extern const char *format_subject(struct strbuf *sb, const char *msg,
104
const char *line_separator);
pretty.c
+2
-11
@@ -1341,16 +1341,6 @@ void pp_remainder(const struct pretty_print_context *pp,
1341
}
1342
}
1343
1344
-char *reencode_commit_message(const struct commit *commit, const char **encoding_p)
1345
-{
1346
- const char *encoding;
1347
-
1348
- encoding = get_log_output_encoding();
1349
- if (encoding_p)
1350
- *encoding_p = encoding;
1351
- return logmsg_reencode(commit, encoding);
1352
-}
1353
-
1344
void pretty_print_commit(const struct pretty_print_context *pp,
1345
const struct commit *commit,
1346
struct strbuf *sb)
@@ -1367,7 +1357,8 @@ void pretty_print_commit(const struct pretty_print_context *pp,
1357
return;
1358
}
1359
1370
- reencoded = reencode_commit_message(commit, &encoding);
1360
+ encoding = get_log_output_encoding();
1361
+ reencoded = logmsg_reencode(commit, encoding);
1362
if (reencoded) {
1363
msg = reencoded;
1364
}