rust-lang / rust-lang/cargo

Index: use a bare repository rather than a non-bare repository without checkout

Open
#9,503 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-git C-feature-request S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Ever since https://github.com/rust-lang/cargo/issues/4015 , Cargo avoids checking out the index as a working directory; however, cargo still creates the repository as a non-bare repository with a working directory that just doesn't have any files checked out.

Ideally, I'd love to store this as a bare repository instead, where git doesn't expect to have a working directory.

This would have a few advantages:

  • Git tools would understand the repository better, making it easier to explore and understand and debug.
  • Tools that want to check .cargo into git (for caching or testing or other purposes) would be able to do so; git can track a repo.git bare repository, but cannot track a .git directory.

(This was discussed briefly in a Cargo team meeting; I'm filing this issue as a follow-up.)

If we don't worry about a one-time re-download of the index, we could solve this by just switching to a bare repository.

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 locating Cargo's index repository creation and checkout logic, then inspect any existing tests around index initialization. Compare the current non-bare setup with the bare-repository behavior described here, including the one-time re-download tradeoff. Done means the index is stored as a bare repository and relevant behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.