Skip to content

Commit c75e7ad

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ae18165 commit c75e7ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pretty.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
146146
struct cmt_fmt_map *commit_format;
147147

148148
rev->use_terminator = 0;
149-
if (!arg || !*arg) {
149+
if (!arg) {
150150
rev->commit_format = CMIT_FMT_DEFAULT;
151151
return;
152152
}
@@ -155,7 +155,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
155155
return;
156156
}
157157

158-
if (strchr(arg, '%')) {
158+
if (!*arg || strchr(arg, '%')) {
159159
save_user_format(rev, arg, 1);
160160
return;
161161
}

0 commit comments

Comments
 (0)