Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote branch being removed when there is local branch tracking it #708

Open
insha opened this issue Jun 8, 2020 · 0 comments
Open

Remote branch being removed when there is local branch tracking it #708

insha opened this issue Jun 8, 2020 · 0 comments

Comments

@insha
Copy link

insha commented Jun 8, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant