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

Re: Are concurrent git operations on the same repo safe?

From
Stefan Beller <sbeller@google.com>
Date
Feb 6, 2018, 17:30 UTC
Message-ID
<CAGZ79kb+SB3q720Q_QbpPTLsY-gfsYHGdSvK2TGOtRXwLMQyOg@mail.gmail.com>
In-Reply-To
<CACsJy8Bhu6RvedKgOx8uExrJuo0-b66JvnZA9d9v4Uk6mSwPQQ@mail.gmail.com>
On Tue, Feb 6, 2018 at 2:16 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 31 quoted lines
> On Tue, Feb 6, 2018 at 3:16 AM, Ian Norton <inorton@gmail.com> wrote:
>> Hi all,
>>
>> I'm generally used to the idea that if a thing is not marked as
>> "thread-safe" then it isn't thread safe, but I thought I'd ask anyway
>> to be sure.
>>
>> Is it safe for me to do several operations with git concurrently on
>> the same local repo?
>
> Off the top of my head, object database access (e.g. things in
> .git/objects), refs updates (.git/refs) and .git/index should handle
> concurrent operations fine (or in the worst case you get "some
> operation is ongoing, aborted" and you need to try again but not
> corruption or anything else). I think we generally try to make it safe
> concurrently.
>
>> Specifically I'm trying to speed up "git
>> submodule update" by doing several at the same time.  I've noticed
>> some odd side effects afterwards though when trying to commit changes
>> to my super project.
>
> submodule is a hot area with lots of development lately I think,
> perhaps you're seeing some bugs... CCing at least one submodule
> person...
>
>> Apologies if this is answered elsewhere, my google-foo is weak today.
>>
>> Many thanks
>>
>> Ian

"git submodule update" has the network part parallelized, but not the local part IIRC. (That is cloning/fetching submodules can be done with "-j <n>", but the local checkout is still serial for UX purposes, i.e. it wants to stop at the first conflict and only have one conflict at a time)

Which odd side effects do you see? I'd be curious to see if that is a bug in the code or documentation.

Thanks, Stefan

Previous: Duy NguyenNext: Jonathan Nieder
Message 3 of 5 in “Are concurrent git operations on the same repo safe?”
  1. Ian NortonFeb 5, 2018
  2. Duy NguyenFeb 6, 2018
  3. Stefan BellerFeb 6, 2018
  4. Jonathan NiederFeb 6, 2018
  5. Ian NortonFeb 6, 2018

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.