]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pretty.c
compat: convert modes to use portable file type values
[thirdparty/git.git] / pretty.c
index ac800fa452cb854e15671926052350f257118f6a..31fc76b2fde8297298a7d9ffd38ea7f00eede2fa 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -24,6 +24,11 @@ static size_t commit_formats_len;
 static size_t commit_formats_alloc;
 static struct cmt_fmt_map *find_commit_format(const char *sought);
 
+int commit_format_is_empty(enum cmit_fmt fmt)
+{
+       return fmt == CMIT_FMT_USERFORMAT && !*user_format;
+}
+
 static void save_user_format(struct rev_info *rev, const char *cp, int is_tformat)
 {
        free(user_format);
@@ -146,7 +151,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
        struct cmt_fmt_map *commit_format;
 
        rev->use_terminator = 0;
-       if (!arg || !*arg) {
+       if (!arg) {
                rev->commit_format = CMIT_FMT_DEFAULT;
                return;
        }
@@ -155,7 +160,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
                return;
        }
 
-       if (strchr(arg, '%')) {
+       if (!*arg || strchr(arg, '%')) {
                save_user_format(rev, arg, 1);
                return;
        }
@@ -1520,8 +1525,6 @@ void format_commit_message(const struct commit *commit,
 
        free(context.commit_encoding);
        unuse_commit_buffer(commit, context.message);
-       free(context.signature_check.gpg_output);
-       free(context.signature_check.signer);
 }
 
 static void pp_header(struct pretty_print_context *pp,