[PATCH v2 2/6] pretty: treat "--format=" as an empty userformat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
If we are really concerned with people expecting "--pretty=" to turn on
the default format, we could introduce a new mode "none" which does the
same thing behind the scenes. I don't think it's a problem, though.

 pretty.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pretty.c b/pretty.c
index 3a1da6f..f97a762 100644
--- a/pretty.c
+++ b/pretty.c
@@ -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;
 	}
@@ -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;
 	}
-- 
2.1.0.rc0.286.g5c67d74

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]