rust-lang / rust-lang/git2-rs

Better Docs for Fetch/Possible Fetch Bug

Open
#793 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
450
Avg merge
11m
Merged PRs (30d)
1

Description

Fetching a remote branch does not seem to work in any capacity. If it does the docs really need to better document this behavior as it does not seem to work from any way we've tested.


repo.find_remote("origin")
        .unwrap()
        .fetch(&[branch.to_string()], None, None)
        .unwrap();
let fetch_head = repo.find_reference("FETCH_HEAD").unwrap();
let fetch_commit = repo.reference_to_annotated_commit(&fetch_head).unwrap();
let mut reference = repo.find_reference(&format!("refs/heads/{}", branch)).unwrap(); // this line panics which means it did not properly fetch

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -3, klass: 4, message: "reference 'refs/heads/staging' not found" }', leo-commands\src\repo_commands.rs:53:80

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 reproducing the fetch example and inspect repo_commands.rs at line 53:80, where the missing refs/heads/staging reference is reported. Compare the fetched references with the expected remote-branch behavior. Done means determining whether this is a fetch bug or a documentation gap and documenting or reporting the observed behavior accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.