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

[bug] pull --prune could not delete references due to lock file already exists error

From
ryenus <ryenus@gmail.com>
Date
Jun 25, 2025, 12:32 UTC
Message-ID
<CAKkAvaw0sZ0sW9o_0NZdnZknS8M34UST3PetaPBQj5wwvJyjBA@mail.gmail.com>

today I tried to prune the remote refs in a local repo, but `git pull --prune` failed with an error saying it could not delete references. I retried several times and it failed consistently, without a single ref pruned.

I found this interesting comment while looking into the code here: https://github.com/git/git/blob/bd99d6e8db5e2c56dd24395e9711ee7ee564bf4f/refs.c#L2863-L2895

Show 5 quoted lines
> /*
>  * Since we don't check the references' old_oids, the
>  * individual updates can't fail, so we can pack all of the
>  * updates into a single transaction.
>  */

The problem is the assume is wrong, coz things could fail, one such case is to have two refs like below:

1. origin/TOM/b1
2. origin/TOM/b2
3. origin/tom/b2

Notice there's `TOM` vs `tom` in the path. Another factor is that my local file system is case insensitive. As a result the 3rd ref would fail and cause the transaction to be always rolled back.

Next: K Jayatheerth
Message 1 of 14 in “[bug] pull --prune could not delete references due to lock file already exists error”
  1. ryenusJun 25, 2025
  2. Re [bug] pull --prune could not delete references due to lock file already exists errorK Jayatheerth, Jun 25, 2025
  3. brian m. carlsonJun 27, 2025
  4. JAYATHEERTH KJun 30, 2025
  5. Karthik NayakJun 30, 2025
  6. brian m. carlsonJun 30, 2025
  7. Junio C HamanoJun 30, 2025
  8. Patrick SteinhardtJul 1, 2025
  9. Junio C HamanoJul 1, 2025
  10. Patrick SteinhardtJul 2, 2025
  11. Karthik NayakJul 1, 2025
  12. Chris TorekJul 2, 2025
  13. Junio C HamanoJul 2, 2025
  14. JAYATHEERTH KJul 1, 2025

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.