path: root/strbuf.c
diff options
authorRené Scharfe <>2017-06-14 18:24:25 (GMT)
committerJunio C Hamano <>2017-06-15 18:40:53 (GMT)
commitfe9e2aefd4adac63821d0c007effcc8087e32ad6 (patch)
treeacc9011fb27de95e3e628f6efde92548812f9e99 /strbuf.c
parent840ed141983718e0c5518a325534a5656797132a (diff)
pretty: recalculate duplicate short hashes
b9c6232138 (--format=pretty: avoid calculating expensive expansions twice) optimized adding short hashes multiple times by using the fact that the output strbuf was only ever simply appended to and copying the added string from the previous run. That prerequisite is no longer given; we now have modfiers like %< and %+ that can cause the cache to lose track of the correct offsets. Remove it. Reported-by: Michael Giuffrida <> Signed-off-by: Rene Scharfe <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'strbuf.c')
1 files changed, 0 insertions, 7 deletions
diff --git a/strbuf.c b/strbuf.c
index b839be4..df2c113 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -204,13 +204,6 @@ void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2)
strbuf_setlen(sb, sb->len + sb2->len);
-void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len)
- strbuf_grow(sb, len);
- memcpy(sb->buf + sb->len, sb->buf + pos, len);
- strbuf_setlen(sb, sb->len + len);
void strbuf_addchars(struct strbuf *sb, int c, size_t n)
strbuf_grow(sb, n);