All of lore.kernel.org
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Jonathan Tan <jonathantanmy@google.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] fetch-pack: respect --no-update-shallow in v2
Date: Tue, 26 Mar 2019 17:14:11 +0700	[thread overview]
Message-ID: <CACsJy8BHBR2OAHjr-LO4HEmwrmga++5RS1K76qKnh36Hsw9Chw@mail.gmail.com> (raw)
In-Reply-To: <20190326052011.GB1933@sigill.intra.peff.net>

On Tue, Mar 26, 2019 at 12:20 PM Jeff King <peff@peff.net> wrote:
>
> On Mon, Mar 25, 2019 at 01:43:23PM -0700, Jonathan Tan wrote:
>
> > In protocol v0, when sending "shallow" lines, the server distinguishes
> > between lines caused by the remote repo being shallow and lines caused
> > by client-specified depth settings. Unless "--update-shallow" is
> > specified, there is a difference in behavior: refs that reach the former
> > "shallow" lines, but not the latter, are rejected. But in v2, the server
> > does not, and the client treats all "shallow" lines like lines caused by
> > client-specified depth settings.
> >
> > Full restoration of v0 functionality is not possible without protocol
> > change,
>
> That's rather unfortunate. Is this because the v2 ls-refs phase is
> separate, and that's when a v0 server would tell us about its shallows?
> It looks like in v2 it comes in a separate "shallow-info" section.
>
> What would the protocol change look like?  Would we just need a
> capability to instruct the server to mark the two different types of
> shallow distinctly? Or do we actually need to convey the information
> separately (e.g., in the ls-refs phase)?
>
> None of that matters for your patch here, but I'm just wondering what
> the path forward is.

If it helps (because I'm still catching up with v2 to actually help
review), this case is for cloning from a shallow repo. The commit that
outlines how .git/shallow is updated is 58babfffde (shallow.c: the 8
steps to select new commits for .git/shallow, 2013-12-05).

Since the first shallow info is about the shape of the remote repo
(where refs are the tips), ls-refs sounds like the right place to
include the information. In other words, ls-refs currently tells the
tip/top of the repo, what's missing is the piece about "the bottom"
(shallow cut points).

> > but we can implement a heuristic: if we specify any depth
> > setting, treat all "shallow" lines like lines caused by client-specified
> > depth settings (that is, unaffected by "--no-update-shallow"), but
> > otherwise, treat them like lines caused by the remote repo being shallow
> > (that is, affected by "--no-update-shallow"). This restores most of v0
> > behavior, except in the case where a client fetches from a shallow
> > repository with depth settings.
>
> That seems like the best we can do without the protocol change. And even
> if we adjust the protocol, we need some fallback behavior for existing
> v2 servers, so this is worth doing.

Are people actually doing this (i.e. cloning from or  pushing to a
shallow repo)? I added this with the intention that a big shallow repo
(e.g. one year long history) is served as the common source to reduce
server loads and everything, while the full/big repo is available but
rarely needed. I never saw anyone complain about it (so, likely not
using it).

The description of --update-shallow probably should mention this
fallback behavior? --update-shallow was not default because I feared
the local repo could be cut short by unsolicited shallow requests from
the server side, and it looks like --update-shallow is default (by
mistake) in v2? Maybe I worried for nothing. I dunno.
-- 
Duy

  reply	other threads:[~2019-03-26 10:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 20:43 [PATCH 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully Jonathan Tan
2019-03-25 20:43 ` [PATCH 1/2] fetch-pack: call prepare_shallow_info only if v0 Jonathan Tan
2019-03-26  5:00   ` Jeff King
2019-03-25 20:43 ` [PATCH 2/2] fetch-pack: respect --no-update-shallow in v2 Jonathan Tan
2019-03-26  5:20   ` Jeff King
2019-03-26 10:14     ` Duy Nguyen [this message]
2019-03-26 15:18       ` Jeff King
2019-03-26 15:39         ` Duy Nguyen
2019-03-26 17:37     ` Jonathan Tan
2019-03-26 18:18       ` Jeff King
2019-03-26 17:53 ` [PATCH v2 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully Jonathan Tan
2019-03-26 17:53   ` [PATCH v2 1/2] fetch-pack: call prepare_shallow_info only if v0 Jonathan Tan
2019-03-26 17:53   ` [PATCH v2 2/2] fetch-pack: respect --no-update-shallow in v2 Jonathan Tan
2019-03-26 18:23     ` Jeff King
2019-03-26 18:20   ` [PATCH v2 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully Jeff King
2019-03-26 19:31 ` [PATCH v3 " Jonathan Tan
2019-03-26 19:31   ` [PATCH v3 1/2] fetch-pack: call prepare_shallow_info only if v0 Jonathan Tan
2019-03-26 19:31   ` [PATCH v3 2/2] fetch-pack: respect --no-update-shallow in v2 Jonathan Tan

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=CACsJy8BHBR2OAHjr-LO4HEmwrmga++5RS1K76qKnh36Hsw9Chw@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.