Subject: [PATCH v3 0/2] bundle-uri: copy all bundle references ino the refs/bundle space

From: "Scott Chacon via GitGitGadget" <[email-masked]>
Date: Tue, 18 Mar 2025 15:36:11 +0000

Rebased the series onto current master and squashed the patch that modified
the existing test into the main patch.

> bundle-uri: copy all bundle references ino the refs/bundle space
> bundle-uri: update bundle clone tests with new refspec path

Scott Chacon (2):
  bundle-uri: copy all bundle references ino the refs/bundle space
  bundle-uri: add test for bundle-uri clones with tags

 bundle-uri.c                |   2 +-
 t/t5558-clone-bundle-uri.sh | 203 +++++++++++++++++++++---------------
 2 files changed, 118 insertions(+), 87 deletions(-)

base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1897%2Fschacon%2Fsc-more-bundle-refs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1897/schacon/sc-more-bundle-refs-v3
Pull-Request: https://github.com/git/git/pull/1897

Range-diff vs v2:

 1:  b36bc876fe1 < -:  ----------- bundle-uri: copy all bundle references ino the refs/bundle space
 2:  5e198ba5c66 ! 1:  2ccbfdcc2dc bundle-uri: update bundle clone tests with new refspec path
     @@ Metadata
      Author: Scott Chacon <[email-masked]>
      
       ## Commit message ##
     -    bundle-uri: update bundle clone tests with new refspec path
     +    bundle-uri: copy all bundle references ino the refs/bundle space
     +
     +    When downloading bundles via the bundle-uri functionality, we only copy the
     +    references from refs/heads into the refs/bundle space. I'm not sure why this
     +    refspec is hardcoded to be so limited, but it makes the ref negotiation on
     +    the subsequent fetch suboptimal, since it won't use objects that are
     +    referenced outside of the current heads of the bundled repository.
     +
     +    This change to copy everything in refs/ in the bundle to refs/bundles/
     +    significantly helps the subsequent fetch, since nearly all the references
     +    are now included in the negotiation.
      
          The update to the bundle-uri unbundling refspec puts all the heads from a
          bundle file into refs/bundle/heads instead of directly into refs/bundle/ so
     -    the tests need to be updated to look in the new heirarchy.
     +    the tests also need to be updated to look in the new heirarchy.
      
          Signed-off-by: Scott Chacon <[email-masked]>
      
     + ## bundle-uri.c ##
     +@@ bundle-uri.c: static int unbundle_from_file(struct repository *r, const char *file)
     + 		const char *branch_name;
     + 		int has_old;
     + 
     +-		if (!skip_prefix(refname->string, "refs/heads/", &branch_name))
     ++		if (!skip_prefix(refname->string, "refs/", &branch_name))
     + 			continue;
     + 
     + 		strbuf_setlen(&bundle_ref, bundle_prefix_len);
     +
       ## t/t5558-clone-bundle-uri.sh ##
      @@ t/t5558-clone-bundle-uri.sh: test_expect_success 'create bundle' '
       test_expect_success 'clone with path bundle' '
 3:  ea204679cb0 = 2:  d148b14c390 bundle-uri: add test for bundle-uri clones with tags

-- 
gitgitgadget