summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-07 20:49:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-01-07 20:49:19 (GMT)
commit58e0362eddba1678a71c8990862053ff989527b6 (patch)
tree3d3a41a516dc7cc1343c5f71f212eb79f1662632 /strbuf.c
parentf41157e649615ada01f175d00f9bd8c9ea507bca (diff)
parentd55aeb7687448189327ad058096b55431da5ea42 (diff)
downloadgit-58e0362eddba1678a71c8990862053ff989527b6.zip
git-58e0362eddba1678a71c8990862053ff989527b6.tar.gz
git-58e0362eddba1678a71c8990862053ff989527b6.tar.bz2
Merge branch 'jc/strbuf-add-lines-avoid-sp-ht-sequence'
The commented output used to blindly add a SP before the payload line, resulting in "# \t<indented text>\n" when the payload began with a HT. Instead, produce "#\t<indented text>\n". * jc/strbuf-add-lines-avoid-sp-ht-sequence: strbuf_add_commented_lines(): avoid SP-HT sequence in commented lines
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/strbuf.c b/strbuf.c
index 0346e74..88cafd4 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -229,7 +229,8 @@ static void add_lines(struct strbuf *out,
const char *next = memchr(buf, '\n', size);
next = next ? (next + 1) : (buf + size);
- prefix = (prefix2 && buf[0] == '\n') ? prefix2 : prefix1;
+ prefix = ((prefix2 && (buf[0] == '\n' || buf[0] == '\t'))
+ ? prefix2 : prefix1);
strbuf_addstr(out, prefix);
strbuf_add(out, buf, next - buf);
size -= next - buf;