Thread (33 messages) flat view 33 messages, 4 authors, 2017-08-18

Re: [PATCH 5/5] commit: rewrite read_graft_line

From: Stefan Beller <hidden>
Date: 2017-08-15 17:11:29

On Tue, Aug 15, 2017 at 4:49 AM, Patryk Obara [off-list ref] wrote:
quoted hunk ↗ jump to hunk
The previous implementation of read_graft_line used calculations based
on GIT_SHA1_RAWSZ and GIT_SHA1_HEXSZ to determine the number of commit
ids in a single graft line.  New implementation does not depend on these
constants, so it adapts to any object_id buffer size.

To make this possible, FLEX_ARRAY of object_id in struct was replaced
by an oid_array.

Code allocating graft now needs to use memset to zero the memory before
use to start with oid_array in a consistent state.

Updates free_graft function implemented in the previous patch to
properly cleanup an oid_array storing parents.

Signed-off-by: Patryk Obara <redacted>
---
 commit.c  | 39 +++++++++++++++++++++------------------
 commit.h  |  2 +-
 shallow.c |  1 +
 3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/commit.c b/commit.c
index 6a145f1..75dd45d 100644
--- a/commit.c
+++ b/commit.c
@@ -111,6 +111,7 @@ static int commit_graft_pos(const unsigned char *sha1)

 void free_commit_graft(struct commit_graft *graft)
 {
+       oid_array_clear(&graft->parents);
Oh patch 4/5 could just say it's in preparation of this patch.
Nevermind the comment on patch 4.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help