summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-16 19:18:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-16 20:48:22 (GMT)
commiteff80a9fd990de3605063050dae32f969ef18ba8 (patch)
tree6a7b0c000cea480ac8e2714cbbf92691b7237b55 /strbuf.h
parent44fe83502edf5391bb3a5997cab01794b4568062 (diff)
downloadgit-eff80a9fd990de3605063050dae32f969ef18ba8.zip
git-eff80a9fd990de3605063050dae32f969ef18ba8.tar.gz
git-eff80a9fd990de3605063050dae32f969ef18ba8.tar.bz2
Allow custom "comment char"
Some users do want to write a line that begin with a pound sign, #, in their commit log message. Many tracking system recognise a token of #<bugid> form, for example. The support we offer these use cases is not very friendly to the end users. They have a choice between - Don't do it. Avoid such a line by rewrapping or indenting; and - Use --cleanup=whitespace but remove all the hint lines we add. Give them a way to set a custom comment char, e.g. $ git -c core.commentchar="%" commit so that they do not have to do either of the two workarounds. [jc: although I started the topic, all the tests and documentation updates, many of the call sites of the new strbuf_add_commented_*() functions, and the change to git-submodule.sh scripted Porcelain are from Ralf.] Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index ecae4e2..958822c 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -110,6 +110,8 @@ extern void strbuf_remove(struct strbuf *, size_t pos, size_t len);
extern void strbuf_splice(struct strbuf *, size_t pos, size_t len,
const void *, size_t);
+extern void strbuf_add_commented_lines(struct strbuf *out, const char *buf, size_t size);
+
extern void strbuf_add(struct strbuf *, const void *, size_t);
static inline void strbuf_addstr(struct strbuf *sb, const char *s) {
strbuf_add(sb, s, strlen(s));
@@ -131,6 +133,8 @@ extern void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *
__attribute__((format (printf,2,3)))
extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
+__attribute__((format (printf, 2, 3)))
+extern void strbuf_commented_addf(struct strbuf *sb, const char *fmt, ...);
__attribute__((format (printf,2,0)))
extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap);