Re: [PATCH 092/194] object: move grafts to object parser
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 6, 2018, 04:07 UTC
- Message-ID
- <CAPig+cT4=WA2PpovtG1M5hsrTxzDYdGjiYgvpp4Pbggc3Qo-Yw@mail.gmail.com>
- In-Reply-To
- <20180205235735.216710-72-sbeller@google.com>
On Mon, Feb 5, 2018 at 6:55 PM, Stefan Beller <sbeller@google.com> wrote:
Show 25 quoted lines
> Grafts are only meaningful in the context of a single repository.
> Therefore they cannot be global.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> diff --git a/commit.c b/commit.c
> @@ -121,20 +120,22 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups)
> if (ignore_dups)
> free(graft);
> else {
> - free(commit_graft[pos]);
> - commit_graft[pos] = graft;
> + free(the_repository->parsed_objects.grafts[pos]);
> + the_repository->parsed_objects.grafts[pos] = graft;
> diff --git a/object.h b/object.h
> @@ -4,9 +4,13 @@
> struct object_parser {
> struct object **obj_hash;
> int nr_objs, obj_hash_size;
> +
> + /* parent substitutions from .git/info/grafts and .git/shallow */
> + struct commit_graft **grafts;
> + int grafts_alloc, grafts_nr;
> };Do items moved to object_parser need to get freed when object_parser itself is freed? Is that happening in some other patch?