git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.36k stars 2.54k forks source link

Git gc does not remove garbage files #5191

Open mateuszkuta256 opened 2 weeks ago

mateuszkuta256 commented 2 weeks ago

Setup

Microsoft Windows [Version 10.0.19045.48941

Details

dscho commented 2 weeks ago
  • gc will remove garbage .pack even if the corresponding index is missing or

Hmm. That might be possible. But. The idea is that packfiles are indexed while they are downloaded, and as long as there is no .idx file they are not considered to be active. You may very well delete (on platforms where files can be deleted while they are being written to) an in-progress packfile.

  • git will never remove .idx if the corresponding .pack is locked

This might be the easier variant: You would need to replace this call:

    string_list_sort(&names);

by a call to qsort() using a compare function that would sort .idx files after their corresponding .pack files.