commit: helper methods to reduce redundant blocks of code
[git/git.git] / pretty.c
index f85444b..c253172 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -886,8 +886,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
        case 'N':
                if (c->pretty_ctx->show_notes) {
                        format_display_notes(commit->object.sha1, sb,
        case 'N':
                if (c->pretty_ctx->show_notes) {
                        format_display_notes(commit->object.sha1, sb,
-                                   git_log_output_encoding ? git_log_output_encoding
-                                                           : git_commit_encoding, 0);
+                                   get_log_output_encoding(), 0);
                        return 1;
                }
                return 0;
                        return 1;
                }
                return 0;
@@ -1159,11 +1158,7 @@ char *reencode_commit_message(const struct commit *commit, const char **encoding
 {
        const char *encoding;
 
 {
        const char *encoding;
 
-       encoding = (git_log_output_encoding
-                   ? git_log_output_encoding
-                   : git_commit_encoding);
-       if (!encoding)
-               encoding = "UTF-8";
+       encoding = get_log_output_encoding();
        if (encoding_p)
                *encoding_p = encoding;
        return logmsg_reencode(commit, encoding);
        if (encoding_p)
                *encoding_p = encoding;
        return logmsg_reencode(commit, encoding);