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>
This commit is contained in:
@ -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";
|
||||
}
|
||||
|
Reference in New Issue
Block a user