Skip to content

Delete a cached Git repository from the UI and API #685

Open

Description

@simonchrz

Follow-up to #675, which lists cached Git repositories on /ui/git.

Today the only way to remove one repository from the git cache is to stop the server and delete its directory under git.cache_dir. Deleting it while the server runs leaves the cache's size accounting wrong until the next start and can break a running fetch.

Proposal, behind the existing cache_delete setting:

  • DELETE /api/git/{upstream}/{path}.git removes one cached repository, and /ui/git gets a Delete button per row, sending to /ui/api/git/... like the version page does for artifacts.
  • It reuses the eviction path: the repository is dropped from the cache at once, so the next request clones it again, and its directory is removed once no request is reading it.
  • A repository in the middle of a clone or fetch answers 409 rather than waiting.
  • The response says what was removed and how many bytes are freed.

I'd open the PR after #675 is in. Does this fit, or would you rather keep git out of cache_delete?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions