]> git.proxmox.com Git - libgit2.git/commit
index: fix shared prefix computation when writing index entry
authorPatrick Steinhardt <ps@pks.im>
Fri, 19 May 2017 11:49:34 +0000 (13:49 +0200)
committerPatrick Steinhardt <ps@pks.im>
Tue, 6 Jun 2017 07:38:44 +0000 (09:38 +0200)
commitc71dff7e8a1bde298972c10901802608bd4cbb55
tree8696971e9135dc5b159cb6181387385b6121007c
parent83e0392ceadb7e1d9db09a7f013e28759a666e89
index: fix shared prefix computation when writing index entry

When using compressed index entries, each entry's path is preceded by a
varint encoding how long the shared prefix with the previous index entry
actually is. We currently encode a length of `(path_len - same_len)`,
which is doubly wrong. First, `path_len` is already set to `path_len -
same_len` previously. Second, we want to encode the shared prefix rather
than the un-shared suffix length.

Fix this by using `same_len` as the varint value instead.
src/index.c