diff options
| author | Junio C Hamano <gitster@pobox.com> | 2014-09-02 13:25:03 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2014-09-02 13:25:04 -0700 |
| commit | 44ceb79f84b0f339147d2d44e4bb50cc472be03e (patch) | |
| tree | 207c1f0e269f9d99602ae9043ad6a259428a9831 /pretty.c | |
| parent | 56f214e0716dec043b50a7e1e8cc181be2ef7df2 (diff) | |
| parent | b9c7d6e4330e3dcdb3b3e5f013e5667e47555c95 (diff) | |
| download | git-44ceb79f84b0f339147d2d44e4bb50cc472be03e.tar.xz | |
Merge branch 'jk/pretty-empty-format'
"git log --pretty/format=" with an empty format string did not mean
the more obvious "No output whatsoever" but "Use default format",
which was counterintuitive.
* jk/pretty-empty-format:
pretty: make empty userformats truly empty
pretty: treat "--format=" as an empty userformat
revision: drop useless string offset when parsing "--pretty"
Diffstat (limited to 'pretty.c')
| -rw-r--r-- | pretty.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; } |
