Ensure automatic `git gc` operations run in the foreground

What does this MR do?

Ensure automatic git gc operations run in the foreground

Various git subcommands will, if the repository is long-standing has a lot of loose objects, trigger an automatic git gc against the repository. By default this gc will occur in the background, which has the potential to lock certain files which subsequent commands might require access to, e.g. files within .git/refs could be locked when refs are being repacked, thus fetch will fail.

Set gc.autoDetach=false to force these operations to run in the foreground to ensure subsequent commands don't fail due to the existence of lock files.

Why was this MR needed?

Despite already cleaning up lock files within the .git/refs directory, users can still hit instances of fetches being blocked by lock files due to git gc jobs running in the background.

What's the best way to test this MR?

What are the relevant issue numbers?

Might help with #38529 (closed).

Edited by Toon Claes

Merge request reports

Loading