8000 Remote branch being removed when there is local branch tracking it · Issue #708 · libgit2/objective-git · GitHub
[go: up one dir, main page]

Skip to content
Remote branch being removed when there is local branch tracking it #708
Open
@insha

Description

@insha

Hi,

I am trying to show both local and remote branches for a repository. Therefore, I am using the method -branches: that is available on the GTRepository class. In the header file the comment for this method states:

/// Get the local and remote branches and merge them together by combining local
/// branches with their remote branch, if they have one.

What's happening is that for a repository where I have a local branch named "master" and this local branch is tracking a remote branch that is called "origin/master"; upon calling the -branches:error method I get the list of branches for this repository.

Expected Behavior: This method will return both "master" and "origin/master" in the array.

Actual Behavior: The "origin/master" branch is not in that list; however, the local "master" branch is listed.

Looking at the implementation of the -branches:error method, on line.485, the -trackingBranchWithError:success method is being called on the GTBranch object. When this method returns a non nil value, the following line is removed from the remote branch list.

The issue, at least for me, is that I am showing both local and remote branches in separate groups, "local" and "remote". Therefore, while all local branches show up just fine in the local group, any remote branch that is being tracked by a local branch is not shown in the remote group.

Given that, from my perspective, this seems like a bug, if so, I am more than happy to submit a PR for it. If it is not, would it be possible to help me understand in which cases I will use the -branches: method instead of the individual -localBranchesWithError: and -remoteBranchesWithError:?

Also using this method, how would I separate out the local and remote branches?

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

      0