Commit e2294859 by Patrick Wang Committed by Edward Thomson

index: write v4: bugfix: prefix path with strip_len, not same_len

According to index-format.txt of git, the path of an entry is prefixed
with N, where N indicates the length of bytes to be stripped.
parent 8edc39df
......@@ -2744,7 +2744,7 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
++same_len;
}
path_len -= same_len;
varint_len = git_encode_varint(NULL, 0, same_len);
varint_len = git_encode_varint(NULL, 0, strlen(last) - same_len);
}
disk_size = index_entry_size(path_len, varint_len, entry->flags);
......@@ -2795,7 +2795,7 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
if (last) {
varint_len = git_encode_varint((unsigned char *) path,
disk_size, same_len);
disk_size, strlen(last) - same_len);
assert(varint_len > 0);
path += varint_len;
disk_size -= varint_len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment