{"thread":{"id":"65675","subject":"Why do we need to wait 1s between a git add and commit","startedAt":"2026-05-22T12:28:52Z","lastAt":"2026-05-22T17:14:10Z","messageCount":3,"participants":["Fabrice SALVAIRE","Kristoffer Haugsbakk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"543919","messageId":"36eec9c1-1d2b-4cd1-a64c-a02936d8a2ae@orange.fr","threadId":"65675","inReplyTo":null,"subject":"Why do we need to wait 1s between a git add and commit","fromName":"Fabrice SALVAIRE","fromEmail":"fabrice.salvaire@orange.fr","sentAt":"2026-05-22T12:28:44Z","receivedAt":"2026-05-22T12:28:52Z","isPatch":false,"body":"Dear all,\n\nI wrote a Python tool to dump a wiki to a git repository, that does \nbasically a succession of subprocess calls to git add and commit.\n\nRecently, I discovered this tool doesn't work any longer and that git \ncommit (2.54 on Fedora 42 / 43) crashes randomly.\n\nI cannot explain this behavior since my code is trivial.\n\nI had the intuition to add a sleep time of 1s just after a git call, and \nit solves the issue.\n\nI noticed for some cases that another call to git commit were \nsuccessful. For most cases, git fsck and gitk report issues.\n\nIt looks like the state of the git repository was not yet completed \nbefore the end of the git subprocess.\n\nCheers,\n\n"},{"id":"543922","messageId":"b403477d-5587-4afc-bd02-dbd207c22e67@app.fastmail.com","threadId":"65675","inReplyTo":"36eec9c1-1d2b-4cd1-a64c-a02936d8a2ae@orange.fr","subject":"Re: Why do we need to wait 1s between a git add and commit","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2026-05-22T15:12:21Z","receivedAt":"2026-05-22T15:12:44Z","isPatch":false,"body":"Hi\n\nOn Fri, May 22, 2026, at 14:28, Fabrice SALVAIRE wrote:\n> I wrote a Python tool to dump a wiki to a git repository, that does\n> basically a succession of subprocess calls to git add and commit.\n>\n> Recently, I discovered this tool doesn't work any longer and that git\n> commit (2.54 on Fedora 42 / 43) crashes randomly.\n>\n> I cannot explain this behavior since my code is trivial.\n>\n> I had the intuition to add a sleep time of 1s just after a git call, and\n> it solves the issue.\n>\n> I noticed for some cases that another call to git commit were\n> successful. For most cases, git fsck and gitk report issues.\n>\n> It looks like the state of the git repository was not yet completed\n> before the end of the git subprocess.\n\nThis might be caused by git-maintenance(1) being run in the background\nwithout locking? That’s a new issue in Git 2.54.0. See:\n\nhttps://lore.kernel.org/git/20260509175249.GA2336928@coredump.intra.peff.net/\n\nThe following script reproduces the issue on Git 2.53.0. I am guessing\nthat your script does something similar? It depends on how many commits\nit creates in a short timeframe.\n\nhttps://lore.kernel.org/git/20260508180341.GB737125@coredump.intra.peff.net/\n"},{"id":"543933","messageId":"9767f411-ce33-43a1-aafc-5ec4f7c04593@orange.fr","threadId":"65675","inReplyTo":"b403477d-5587-4afc-bd02-dbd207c22e67@app.fastmail.com","subject":"Re: Why do we need to wait 1s between a git add and commit","fromName":"Fabrice SALVAIRE","fromEmail":"fabrice.salvaire@orange.fr","sentAt":"2026-05-22T17:13:52Z","receivedAt":"2026-05-22T17:14:10Z","isPatch":false,"body":"Hi,\n\nYes it throws 3000+ sequential subprocess calls at the speed of Python...\n\nAnd the sleep time seems to be critical, 1s is ok but 100ms is not so ok.\n\nI also have the feeling this is due to a git upgrade. But I didn't test \nto downgrade.\n\nThat is a major issue if we have to be slow while using Git...\n\nIt is not unusual to write a shell script with a sequence of add/commit.\n\nLe 22/05/2026 à 17:12, Kristoffer Haugsbakk a écrit :\n> Hi\n>\n> On Fri, May 22, 2026, at 14:28, Fabrice SALVAIRE wrote:\n>> I wrote a Python tool to dump a wiki to a git repository, that does\n>> basically a succession of subprocess calls to git add and commit.\n>>\n>> Recently, I discovered this tool doesn't work any longer and that git\n>> commit (2.54 on Fedora 42 / 43) crashes randomly.\n>>\n>> I cannot explain this behavior since my code is trivial.\n>>\n>> I had the intuition to add a sleep time of 1s just after a git call, and\n>> it solves the issue.\n>>\n>> I noticed for some cases that another call to git commit were\n>> successful. For most cases, git fsck and gitk report issues.\n>>\n>> It looks like the state of the git repository was not yet completed\n>> before the end of the git subprocess.\n> This might be caused by git-maintenance(1) being run in the background\n> without locking? That’s a new issue in Git 2.54.0. See:\n>\n> https://lore.kernel.org/git/20260509175249.GA2336928@coredump.intra.peff.net/\n>\n> The following script reproduces the issue on Git 2.53.0. I am guessing\n> that your script does something similar? It depends on how many commits\n> it creates in a short timeframe.\n>\n> https://lore.kernel.org/git/20260508180341.GB737125@coredump.intra.peff.net/\n"}]}