Skip to content

Commit

Permalink
pretty: treat "--format=" as an empty userformat
Browse files Browse the repository at this point in the history
Until now, we treated "--pretty=" or "--format=" as "give me
the default format". This was not planned nor documented,
but only what happened to work due to our parsing of
"--pretty" (which should give the default format).

Let's instead let these be an actual empty userformat.
Otherwise one must write out the annoyingly long
"--pretty=tformat:" to get the same behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jul 30, 2014
1 parent ae18165 commit c75e7ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pretty.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,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;
}
Expand All @@ -155,7 +155,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;
}
Expand Down

0 comments on commit c75e7ad

Please sign in to comment.