summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-07-29 17:56:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-30 19:30:08 (GMT)
commitb9c7d6e4330e3dcdb3b3e5f013e5667e47555c95 (patch)
tree3b2dac6b6d40dfcf8973f6eb74d062c8eaed13c1 /commit.h
parentc75e7ad28a34081ca6e7e53c0551fa6c99b208b0 (diff)
downloadgit-b9c7d6e4330e3dcdb3b3e5f013e5667e47555c95.zip
git-b9c7d6e4330e3dcdb3b3e5f013e5667e47555c95.tar.gz
git-b9c7d6e4330e3dcdb3b3e5f013e5667e47555c95.tar.bz2
pretty: make empty userformats truly empty
If the user provides an empty format with "--format=", we end up putting in extra whitespace that the user cannot prevent. This comes from two places: 1. If the format is missing a terminating newline, we add one automatically. This makes sense for --format=%h, but not for a truly empty format. 2. We add an extra newline between the pretty-printed format and a diff or diffstat. If the format is empty, there's no point in doing so if there's nothing to separate. With this patch, one can get a diff with no other cruft out of "diff-tree --format= $commit". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/commit.h b/commit.h
index a8cbf52..aa8c3ca 100644
--- a/commit.h
+++ b/commit.h
@@ -159,6 +159,7 @@ extern void get_commit_format(const char *arg, struct rev_info *);
extern const char *format_subject(struct strbuf *sb, const char *msg,
const char *line_separator);
extern void userformat_find_requirements(const char *fmt, struct userformat_want *w);
+extern int commit_format_is_empty(enum cmit_fmt);
extern void format_commit_message(const struct commit *commit,
const char *format, struct strbuf *sb,
const struct pretty_print_context *context);