Skip to content

Add branch querying/filtering feature #147

Open
@nulltoken

Description

@nulltoken

The git-branch doc states

With --contains, shows only the branches that contain the named commit (in other
words, the branches whose tip commits are descendants of the named commit).

With --merged, only branches merged into the named commit (i.e. the branches whose
tip commits are reachable from the named commit) will be listed.

With --no-merged only branches not merged into the named commit will be listed.

If the <commit> argument is missing it defaults to HEAD (i.e. the tip of the
current branch).

A potential API design might rely on the following

  • Add a QueryBy() method to the BranchCollection in a similar way to the CommitCollection.QueryBy() method.
  • Rename the current Filter type to CommitFilter, in order to allow the creation of a BranchFIlter

Binding the following method might also be helpful. Related libgit2 tests can be found here.

/**
 * Find a merge base between two commits
 *
 * @param out the OID of a merge base between 'one' and 'two'
 * @param repo the repository where the commits exist
 * @param one one of the commits
 * @param two the other commit
 */
GIT_EXTERN(int) git_merge_base(
     git_oid *out,
     git_repository *repo,
     git_oid *one,
     git_oid *two);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions