Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPat Notz <patnotz@gmail.com>2010-11-02 22:59:07 +0300
committerJunio C Hamano <gitster@pobox.com>2010-11-04 23:53:34 +0300
commita6fa59924d154f2dcfc331357bf553e043aa0242 (patch)
tree0b70643b0e0a30f6d97acce2a9142af0a80fcde7 /pretty.c
parentc752e7f3e8d96a9673ad248addc9418164bd3ce6 (diff)
commit: helper methods to reduce redundant blocks of code
* builtin/commit.c: Replace block of code with a one-liner call to logmsg_reencode(). * commit.c: new function for looking up a comit by name * pretty.c: helper methods for getting output encodings Add helpers get_log_output_encoding() and get_commit_output_encoding() that eliminate some messy and duplicate if-blocks. Signed-off-by: Pat Notz <patnotz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/pretty.c b/pretty.c
index f85444b27d..c253172ef9 100644
--- 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,
- git_log_output_encoding ? git_log_output_encoding
- : git_commit_encoding, 0);
+ get_log_output_encoding(), 0);
return 1;
}
return 0;
@@ -1159,11 +1158,7 @@ char *reencode_commit_message(const struct commit *commit, 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);