git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git fetch origin $SHA1 doesn't work as often as it could

From
JSJP Sugarbroad <jpsugar@google.com>
Date
May 18, 2016, 22:40 UTC
Message-ID
<CAD0oC4wezb8svOW5KHONLi5wQN+H_3xqPLoU_EZbtL5zAkdv_Q@mail.gmail.com>
In-Reply-To
<xmqq8tz7qb7d.fsf@gitster.mtv.corp.google.com>
On Wed, May 18, 2016 at 5:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
> The commit from the submodule that is bound to the superproject may
> no longer be sitting at the tip of any branch in the submodule.  The
> hack you are outlining here would not help, and invites "the feature
> works some of the time (i.e. the commit happens to be at the tip of
> one of the refs) but fails most of the time" bug reports.

Sure, that's a reasonable fear. In this case the branches don't move, but if one were concerned about that one could use tags instead. It is quite reasonable to point a submodule to a tag and not expect that to go away.

> So I am not enthused, even though at the technical level, I agree
> that it is a good "solution" to pretend as if one of the refs were
> requested after the fetch-pack discovers the refs advertised by the
> upload-pack.
It could also lead to allowing "git clone -b $SHA".

It's possible to implement this today by manually doing the conversion via git ls-remote. This is a significant streamlining that would interact well with the recent change to submodules to attempt "git fetch origin $SHA1".

> I just fear that it is a wrong approach to solve the real issue and
> instead make it worse by relieving the pressure from the project and
> hosting site to configure their repository to support their users
> properly.

Unfortunately I don't see the likes of github or bitbucket adding allow-reachable-sha1-in-want any time soon, as it is an expensive operation server-side.

This is a significant boost to utility of shallow submodules (a flag for which was just recently added to clone), without requiring any significant changes to repository configuration.

- JP
Previous: Junio C HamanoNext: Jeff King
Message 3 of 4 in “git fetch origin $SHA1 doesn't work as often as it could”
  1. JP SugarbroadMay 18, 2016
  2. Junio C HamanoMay 18, 2016
  3. JP SugarbroadMay 18, 2016
  4. Jeff KingMay 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.