libgit2 / libgit2/libgit2

Make sure we keep the packfile locked until we've updated the tips

Open
#2,370 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug up for grabs
Dominant language
C
Stars
10.6k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

This is mostly as a reminder to myself to do this at some point, but if someone feels like it, they're welcome to take this on.

There is some amount of time between the rename of the packfile to its final name and the update of the remote-tracking branches. If a gc process runs between those two operations, it may see that our brand new packfile contains only unreferenced objects, so it might decide to delete it. This would make our ref updates quite unhappy (not to mention the user).

What git does is lock the packfile (via a .keep file, which tells a gc process not to touch it) between those times and then remove the keep-file after the refs have been updated and we now have made our objects reachable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the packfile rename and remote-tracking branch update described in the issue, and inspect how the existing code handles .keep files during that interval. Done means the packfile remains protected from gc until the refs are updated, then the keep-file is removed; the issue names no specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.