rust-lang / rust-lang/git2-rs

Find if a branch is merged into another branch.

Open
#1,150 0 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

I'm attempting, given a list of local branches (repository.branches(Some(BranchType::Local))), to find out which ones have been merged; basically to know if git branch -d "branch name" would give an error telling you the branch isn't fully merged (and that you must use -D if you want to delete anyway).

(this is "pseudo-code" simplified for this issue, so I'm omitting the match clauses, and whatnot)

I'm calling let br = repository.find_branch(&branch_name, BranchType::Local) and then I'm calling let result = br.delete().

This seems like it doesn't care if the branch is merged or not (perhaps I have this all wrong so I once again ask for forgiveness if what I'm trying to do is the "wrong way").

I've come across this: https://github.com/libgit2/libgit2sharp/issues/1433

But this is C#, and I cannot find what the equivalent would be in the rust bindings (my Rust knowledge is also quite limited).

Apologies for creating an Issue, I wasn't sure where to post this.

Thanks in advance.

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

The issue centers on repository.find_branch(..., BranchType::Local) and br.delete(); first compare those APIs with the linked libgit2/libgit2sharp issue and inspect the Rust binding's branch APIs. Done means documenting or exposing the Rust-supported way to determine whether a local branch is fully merged, including the behavior expected before deletion.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
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.