Re: [PATCH v6 8/9] pack-objects: introduce '--stdin-packs=follow'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 23, 2025, 23:35 UTC
- Message-ID
- <xmqq8qli3ub3.fsf@gitster.g>
- In-Reply-To
- <3699c25337e1c91388bad4c56441b39a9984798b.1750717921.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 12 quoted lines
> static void show_object_pack_hint(struct object *object, const char *name,
> - void *data UNUSED)
> + void *data)
> {
> - struct object_entry *oe = packlist_find(&to_pack, &object->oid);
> - if (!oe)
> - return;
> + enum stdin_packs_mode mode = *(enum stdin_packs_mode *)data;
> + if (mode == STDIN_PACKS_MODE_FOLLOW) {
> + if (object->type == OBJ_BLOB &&
> + !has_object(the_repository, &object->oid, 0))
> + return;So, --stdin-packs opened a pack and is feeding the objects contained in it to this machinery. show_commit_pack_hint() calls this function in the `follow` mode. How would such an object be missing? Ah, lazy clones. OK.
> + add_object_entry(&object->oid, object->type, name, 0);
> + } else {And only up to this point is the new code. The "else" clause is just the original indented one-level deeper.
Show 12 quoted lines
> +static void show_commit_pack_hint(struct commit *commit, void *data)
> {
> + enum stdin_packs_mode mode = *(enum stdin_packs_mode *)data;
> +
> + if (mode == STDIN_PACKS_MODE_FOLLOW) {
> + show_object_pack_hint((struct object *)commit, "", data);
> + return;
> + }
> +
> /* nothing to do; commits don't have a namehash */
> +
> }What is this new blank line doing here?