summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-08-26 15:09:47 +0200
committerVicent Marti <tanoku@gmail.com>2014-08-26 17:46:26 +0200
commitebee4d55ded3a4e20378d755ac472672fff8178d (patch)
tree8b8c92659957b8582c0f3a1730d34fd914401d43
parentb401dc9e02213be2e25f9c506cafa7521a6172db (diff)
downloadlibgit2-ebee4d55ded3a4e20378d755ac472672fff8178d.tar.gz
pack: return the correct final 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 ace7abb58..892eeb415 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;