pretty: treat "--format=" as an empty userformat
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>
Jeff King committed
Jul 29, 2014 at 13:54 UTC
c75e7ad28a34081ca6e7e53c0551fa6c99b208b0
1 file changed
+2
-2
pretty.c
+2
-2
@@ -146,7 +146,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
146
struct cmt_fmt_map *commit_format;
147
148
rev->use_terminator = 0;
149
- if (!arg || !*arg) {
149
+ if (!arg) {
150
rev->commit_format = CMIT_FMT_DEFAULT;
151
return;
152
}
@@ -155,7 +155,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
155
return;
156
}
157
158
- if (strchr(arg, '%')) {
158
+ if (!*arg || strchr(arg, '%')) {
159
save_user_format(rev, arg, 1);
160
return;
161
}