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

Re: [BUG] fetching all remote branches results in failed multiple updates

From
AHAlexander Huynh <alex@grande.coffee>
Date
Mar 8, 2019, 00:08 UTC
Message-ID
<20190308000810.GA8044@chabuduo>
In-Reply-To
<20190307234015.GD28939@szeder.dev>
On Fri, Mar 08, 2019 at 12:40:15AM +0100, SZEDER Gábor wrote:
Show 10 quoted lines
> On Thu, Mar 07, 2019 at 09:44:47PM +0000, Alexander Huynh wrote:
> >     [git-test@chabuduo ~]$ cat > ~/.gitconfig
> >     [remote "origin"]
> >     	fetch = +refs/heads/*:refs/remotes/origin/*
>
> Why do you do this?
>
> First, this is the default refspec configuration that clone will fetch
> and set up in the clone's config file anyway.  You don't have to set
> it.

My mistake. I was under the assumption that this configuration variable was needed for git to fetch all remote refs, and that this behaviour wasn't default.

Show 8 quoted lines
> Anyway, this is a side-effect of 515be83382 (clone: respect additional
> configured fetch refspecs during initial fetch, 2018-11-14).  Since
> then the same refspec comes up twice in remote->fetch, once from the
> configuration and once the explicitly added default refspec.  And
> since 'git clone' doesn't run a fully-fledged 'git fetch' and has its
> own simple refs-to-refspec matching logic, it ends up trying to write
> each ref twice, once for each of the two refspecs, in a single ref
> transaction.

Thanks for the clarification! One question: should we update the documentation at https://git-scm.com/docs/git-fetch#CRTB to not list this as an example to follow?

Thanks again, Alex

Previous: SZEDER GáborNext: Junio C Hamano
Message 3 of 6 in “[BUG] fetching all remote branches results in failed multiple updates”
  1. Alexander HuynhMar 7, 2019
  2. SZEDER GáborMar 7, 2019
  3. Alexander HuynhMar 8, 2019
  4. Junio C HamanoMar 8, 2019
  5. Alexander HuynhMar 13, 2019
  6. Alexander HuynhMar 14, 2019

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.