Subject: Re: [PATCH v6 8/9] pack-objects: introduce '--stdin-packs=follow'

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 Jun 2025 16:35:44 -0700

Taylor Blau <[email-masked]> writes:

>  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.

> +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?