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

Re: Behavior of 'git fetch' for commit hashes

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jun 19, 2017, 22:26 UTC
Message-ID
<20170619152658.4559bce4@twelve2.svl.corp.google.com>
In-Reply-To
<20170619104936.706eff69@twelve2.svl.corp.google.com>

On Mon, 19 Jun 2017 10:49:36 -0700 Jonathan Tan <jonathantanmy@google.com> wrote:

> On Mon, 19 Jun 2017 12:09:28 +0000
> <eero.aaltonen@vaisala.com> wrote:
> 
> > For version 2.13.3

Firstly, exactly which version of Git doesn't work? I'm assuming 2.13.1 (as written elsewhere in your e-mail), since 2.13.3 doesn't exist.

Show 5 quoted lines
> > However, the workaround for descbibed abot for git version 2.7.4 no
> > longer works. The result is always
> > fatal: Couldn't find remote ref
> 
> I'll take a look into this.

I tried to reproduce with this script, but it seems to pass even at 2.13.1:

    #!/bin/bash
    rm -rf ~/tmp/x &&
    make --quiet &&
    ./git init ~/tmp/x &&
    ./git -C ~/tmp/x fetch --quiet ~/gitpristine/git master:foo &&
    ./git -C ~/tmp/x fetch ~/gitpristine/git "$(git -C ~/gitpristine/git rev-parse master^)"
    exit $?
Commenting out the first fetch line produces, as expected:
    error: Server does not allow request for unadvertised object <hash>

And I have not seen the "fatal: Couldn't find remote ref" error you describe.

As Stefan alluded to in his earlier e-mail [1], I made a change recently to how "git fetch" handles literal SHA-1s in commit fdb69d3 ("fetch-pack: always allow fetching of literal SHA1s", 2017-05-15). In this case, I don't think that's the cause of this issue (since that change, if anything, makes things more permissive, not less) but that might be a point of interest in an investigation.

[1] https://public-inbox.org/git/CAGZ79kbFeptKOfpaZ23yK=Zw9mJ0_evqPstHKkD1HSCaP_pC5g@mail.gmail.com/
Previous: Jonathan TanNext: eero.aaltonen@vaisala.com
Message 4 of 5 in “Behavior of 'git fetch' for commit hashes”
  1. eero.aaltonen@vaisala.comJun 19, 2017
  2. Stefan BellerJun 19, 2017
  3. Jonathan TanJun 19, 2017
  4. Jonathan TanJun 19, 2017
  5. eero.aaltonen@vaisala.comJun 20, 2017

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.