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

git gc does not clean tmp_pack* files

From
BBoomman <boomman37@gmail.com>
Date
Dec 19, 2024, 02:19 UTC
Message-ID
<CADMKT2-vsUUi-23YGexvxbW9wj0Br+cQcv34eStnw-0EDRiKMw@mail.gmail.com>
Hello,

I'm currently hitting an issue trying to garbage collect a git repo in case of low disk space. After running "git gc" a bunch of times I tried to clean up more and more space on the disk not realizing that when "git gc" fails it just leaves the tmp_pack file there.

D:\Platform>git gc ...blah... fatal: sha1 file '.git/objects/pack/tmp_pack_FG1inp' write error. Out of diskspace fatal: failed to run repack

D:\Platform>git gc ...blah... fatal: sha1 file '.git/objects/pack/tmp_pack_IFvamY' write error. Out of diskspace fatal: failed to run repack

D:\Platform>git gc ...blah... fatal: sha1 file '.git/objects/pack/tmp_pack_khHCC9' write error. Out of diskspace fatal: failed to run repack

D:\Platform>dir .git\objects\pack\tmp*
 Directory of D:\Platform\.git\objects\pack
12/18/2024  05:33 PM     7,367,032,832 tmp_pack_FG1inp
12/18/2024  05:35 PM     3,787,194,368 tmp_pack_IFvamY
12/18/2024  05:39 PM     7,713,062,912 tmp_pack_khHCC9
09/11/2024  11:33 AM     3,068,002,304 tmp_pack_XTVFUi
               4 File(s) 21,935,292,416 bytes
               0 Dir(s)         339,968 bytes free

I believe that before trying to write *anything* to disk "git gc" should try to take exclusive handles on these and wipe them, ideally by default. The total size of these tmp* files is multiple times larger than the repo I'm trying to compact, so if the command just did this pre-cleaning I'd not have hit this problem once I cleaned enough disk space.

Please let me know your thoughts on this.
-Vitaly
Next: Jeff King
Message 1 of 8 in “git gc does not clean tmp_pack* files”
  1. BoommanDec 19, 2024
  2. Jeff KingDec 19, 2024
  3. BoommanDec 19, 2024
  4. Junio C HamanoDec 19, 2024
  5. Jeff KingDec 20, 2024
  6. BoommanDec 21, 2024
  7. Jeff KingDec 28, 2024
  8. BoommanDec 28, 2024

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.