Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
worktree: fix option descriptions for `prune`
[gitweb.git]
/
strbuf.h
diff --git
a/strbuf.h
b/strbuf.h
index 1ea9d0bdeb0980dcaa8670aa43e4ff703fd9d6b8..4a48c0031a7c0df6a7efdb2151d5701dd256fa28 100644
(file)
--- a/
strbuf.h
+++ b/
strbuf.h
@@
-205,7
+205,8
@@
extern int strbuf_cmp(const struct strbuf *, const struct strbuf *);
*/
static inline void strbuf_addch(struct strbuf *sb, int c)
{
- strbuf_grow(sb, 1);
+ if (!strbuf_avail(sb))
+ strbuf_grow(sb, 1);
sb->buf[sb->len++] = c;
sb->buf[sb->len] = '\0';
}