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

Why do we need to wait 1s between a git add and commit

From
FSFabrice SALVAIRE <fabrice.salvaire@orange.fr>
Date
May 22, 2026, 12:28 UTC
Message-ID
<36eec9c1-1d2b-4cd1-a64c-a02936d8a2ae@orange.fr>
Dear all,

I wrote a Python tool to dump a wiki to a git repository, that does basically a succession of subprocess calls to git add and commit.

Recently, I discovered this tool doesn't work any longer and that git commit (2.54 on Fedora 42 / 43) crashes randomly.

I cannot explain this behavior since my code is trivial.

I had the intuition to add a sleep time of 1s just after a git call, and it solves the issue.

I noticed for some cases that another call to git commit were successful. For most cases, git fsck and gitk report issues.

It looks like the state of the git repository was not yet completed before the end of the git subprocess.

Cheers,
Next: Kristoffer Haugsbakk
Message 1 of 3 in “Why do we need to wait 1s between a git add and commit”
  1. Fabrice SALVAIREMay 22, 2026
  2. Kristoffer HaugsbakkMay 22, 2026
  3. Fabrice SALVAIREMay 22, 2026

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.