Skip to content

Commit 92622e6

Browse files
committed
Merge branch 'ss/blame-textconv-fake-working-tree'
* ss/blame-textconv-fake-working-tree: blame.c: Properly initialize strbuf after calling textconv_object(), again
2 parents 5ae0f68 + 8518088 commit 92622e6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

builtin/blame.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,6 +2096,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
20962096
if (!contents_from || strcmp("-", contents_from)) {
20972097
struct stat st;
20982098
const char *read_from;
2099+
char *buf_ptr;
20992100
unsigned long buf_len;
21002101

21012102
if (contents_from) {
@@ -2113,10 +2114,8 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
21132114
switch (st.st_mode & S_IFMT) {
21142115
case S_IFREG:
21152116
if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
2116-
textconv_object(read_from, mode, null_sha1, &buf.buf, &buf_len)) {
2117-
buf.alloc = buf_len;
2118-
buf.len = buf_len;
2119-
}
2117+
textconv_object(read_from, mode, null_sha1, &buf_ptr, &buf_len))
2118+
strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1);
21202119
else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size)
21212120
die_errno("cannot open or read '%s'", read_from);
21222121
break;

0 commit comments

Comments
 (0)