summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-08-26 15:09:47 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-08-26 15:09:47 +0200
commitb3d3459f32805a1290c5f1811b26a3e9e51a10df (patch)
tree8864b1637723ce5a799e285ea19bcf98f8279b34
parent844d226c9d3e1b8f1d58c5a5d57148de6c66d0cf (diff)
downloadlibgit2-cmn/unpack-offset.tar.gz
pack: return the correct final offsetcmn/unpack-offset
The callers of git_packfile_unpack() expect the obj_offset argument to be set to the beginning of the next object. We were mistakenly returning the the offset of the object's data, which causes the CRC function to try to use the wrong offset. Set obj_offset to curpos instead of elem->offset to point to the next element and bring back expected behaviour.
-rw-r--r--src/pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pack.c b/src/pack.c
index 22dbd5647..b05aa91f1 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -744,7 +744,7 @@ cleanup:
git__free(obj->data);
if (elem)
- *obj_offset = elem->offset;
+ *obj_offset = curpos;
git_array_clear(chain);
return error;