Re: git-clone --single-branch clones objects outside of branch
- From
Chris Jerdonek <chris.jerdonek@gmail.com>
- Date
- Jan 29, 2020, 01:59 UTC
- Message-ID
- <CAOTb1wecnwXrOqJa-dq1zyS1ydgQ-c_b_GX7FkWzJPtGk6xL3g@mail.gmail.com>
- In-Reply-To
- <20200128094801.GC574544@coredump.intra.peff.net>
On Tue, Jan 28, 2020 at 1:48 AM Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
> On Sun, Jan 26, 2020 at 10:46:07PM -0800, Chris Jerdonek wrote: > > I'm guessing other flags also don't apply when --local is being used. > > For example, I'm guessing --reference is also ignored when using > > --local, but I haven't checked yet to confirm. It would be nice if the > > documentation gave a heads up in cases like these. Even if hard links > > are being used, it's not clear from the docs whether the objects are > > filtered first, prior to hard linking, when flags like --single-branch > > and --reference are passed. > > No, "--reference" behaves as usual.
On this, I found that --reference does behave differently in the way that I suspected. For example, when run with the default --local, I found that git-clone will create hard links in the new repo to loose objects, even if those objects already exist in the reference repository. When run with --non-local, the objects in the reference repository weren't copied (I didn't find them in the cloned repo's pack file).
So in addition to --single-branch, this seems to be another case where `git-clone --local` will ignore the provided options when deciding what files inside .git/objects/ to hard-link. It just hard-links everything. This is another example of something that I think would be worth mentioning in the docs in some form. Currently, the documentation for --reference suggests that objects won't be created in the new repo if they already exist in the reference repository.
--Chris
Show 6 quoted lines
> However, "--depth" is ignored (and > issues a warning). I don't think it would be wrong to issue a warning > when --single-branch is used locally (though it would not be "single > branch is ignored, since it does impact which refs are copied). But I > kind of wonder if it would be annoying for people who don't care about > having the extra objects reachable.