pub fn bundle_refs(repo: &Path, refs: &[String]) -> Result<Vec<u8>>Expand description
Bundle exactly the named refs (git bundle create - <ref1> <ref2> …). A
bundle of specific refs is a valid bundle: git clone of it yields those
branches and nothing else, so a non-selected branch is genuinely not in it.
A bundle of specific refs carries no HEAD line, and git clone of a
HEAD-less bundle checks out nothing — newer git leaves an empty working
tree. So include HEAD when it points at one of the selected refs: the
clone then checks out that (primary) branch, and because HEAD already
resolves to a selected ref, no unselected branch’s objects are pulled in.
(When HEAD is detached or points at an unselected branch, HEAD is omitted
and clone_bundle’s checkout fallback recovers content on restore.)