Subject: Re: [PATCH 11/11] bundle: unbundle promisor packs

From: Junio C Hamano <[email-masked]>
Date: Mon, 07 Mar 2022 08:56:09 -0800

Derrick Stolee <[email-masked]> writes:

> Of course, looking closer at it... "git bundle unbundle" doesn't
> actually store the refs directly in the refspace, but instead only
> outputs the refs that it used.

True.  I was more thinking about equivalence between

    cd src_repo
    git clone --no-local --filter=... . ../partial.network.cloned
    git bundle create --filter=... partial.bndl
    git clone partial.bndl ../partial.bundle.cloned

The two resulting repositories should look very similar except for
that the remote.origin.* of the former would expect that it pushes
back to where it was cloned from, while the latter would not.

> +		git init unbundled &&
> +		(
> +			cd unbundled &&
> +			# This creates the first pack-file in the
> +			# .git/objects/pack directory. Look for a .promisor.
> +			git bundle unbundle ../partial.bdl >ref-list.txt &&
> +			ls .git/objects/pack/pack-*.promisor >promisor &&
> +			test_line_count = 1 promisor

And can we enumerate the objects we have in .git/objects, both loose
and packed?

> +		) &&
> +
> +		git clone --filter=blob:none --mirror "file://$(pwd)" cloned &&
> +		git -C cloned for-each-ref \
> +			--format="%(objectname) %(refname)" >cloned-refs.txt &&
> +		echo "$(git -C cloned rev-parse HEAD) HEAD" >>cloned-refs.txt &&
> +		test_cmp cloned-refs.txt unbundled/ref-list.txt

Likewise here?  I think the two should match, and that was what I
was wondering if we should enforce.

>  	'
>  done
>  
> --- >8 ---
>
> I also attempted doing a "git clone --bare partial.bdl unbundled.git" to
> get the 'git clone' command to actually place the refs. However, 'git clone'
> does not set up the repository filter based on the bundle, so it reports
> missing blobs (even though there is no checkout).

Understandable, as cloning from a bundle, if I recall correctly, was
done as yet another special case in "git clone", differently from
the main "over the network" code path.  And from end-user's point of
view, I think updating it is part of introducing the filtered
bundle.

Thanks.