diff options
author | Pat Notz <patnotz@gmail.com> | 2010-11-02 20:59:07 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-04 21:53:34 +0100 |
commit | a6fa59924d154f2dcfc331357bf553e043aa0242 (patch) | |
tree | 0b70643b0e0a30f6d97acce2a9142af0a80fcde7 /environment.c | |
parent | Merge branch 'maint' (diff) | |
download | git-a6fa59924d154f2dcfc331357bf553e043aa0242.tar.xz git-a6fa59924d154f2dcfc331357bf553e043aa0242.zip |
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 'environment.c')
-rw-r--r-- | environment.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/environment.c b/environment.c index de5581fe51..a9d44a28a7 100644 --- a/environment.c +++ b/environment.c @@ -192,3 +192,14 @@ int set_git_dir(const char *path) setup_git_env(); return 0; } + +const char *get_log_output_encoding(void) +{ + return git_log_output_encoding ? git_log_output_encoding + : get_commit_output_encoding(); +} + +const char *get_commit_output_encoding(void) +{ + return git_commit_encoding ? git_commit_encoding : "UTF-8"; +} |