git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Chris Jerdonek <chris.jerdonek@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git-clone --single-branch clones objects outside of branch
Date: Tue, 28 Jan 2020 21:23:54 -0500	[thread overview]
Message-ID: <20200129022354.GA596285@coredump.intra.peff.net> (raw)
In-Reply-To: <CAOTb1wecnwXrOqJa-dq1zyS1ydgQ-c_b_GX7FkWzJPtGk6xL3g@mail.gmail.com>

On Tue, Jan 28, 2020 at 05:59:54PM -0800, Chris Jerdonek wrote:

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

Sure, but I'd just consider that the same issue: hardlinking takes
everything in the object database without regard to what's needed. So
--reference still works (and when you repack and break the hardlinks, it
will drop any duplicates as usual), but obviously you have access to the
extra hardlinked objects in the meantime.

IOW, I don't think it's worth calling this out in the --reference
documentation, but could be in the --local documentation. Because the
unusual implication is the same whether --reference is used or not.

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

It says:

  Using an already existing repository as an alternate will require
  fewer objects to be copied from the repository being cloned, reducing
  network and local storage costs.

which I think is still technically true. The hardlinks are free in terms
of storage (and there's no network cost by definition). So at worst
--reference is doing nothing to start with. And the repository has been
setup in such a way that it may yield benefits later (after you repack
and the hardlinks are broken).

This is maybe splitting hairs a bit. The thing that matters, I think, is
where a documentation change should go (and what it should say).

-Peff

      reply	other threads:[~2020-01-29  2:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26 12:39 git-clone --single-branch clones objects outside of branch Chris Jerdonek
2020-01-27  5:55 ` Jeff King
2020-01-27  6:46   ` Chris Jerdonek
2020-01-28  9:48     ` Jeff King
2020-01-29  1:59       ` Chris Jerdonek
2020-01-29  2:23         ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200129022354.GA596285@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=chris.jerdonek@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).