Gitup: Create Pull Request doesn't show if the repo origin doesn't end in `.git`

Created on 10 May 2016  ·  17Comments  ·  Source: git-up/GitUp

I am currently working on a repository that has no develop branch.

All the feature/XXX /bug/XXX etc. is done back to master by design. So the typical flow to create a pull request from Gitup fails because there's no option to Create Pull Request….

I attribute this to the lack of develop branch (but I have no proof). Other repositories (with develop) seem to offer the option without a problem.

I have no control over this repository so I have to manually create PRs from the web.

The default destination for PRs should be either configurable or at least an option during the PR creation.

All 17 comments

The name of the branch doesn't matter. However it must have an upstream:
https://github.com/git-up/GitUp/blob/master/GitUpKit/Views/GIMapViewController.m#L455

I have double checked this and I cannot see the Create Pull Request option.
This is how I branched from master, made a couple of commits and pushed them.

screen shot 2016-05-10 at 2 28 19 pm

You can check I have set my upstream as well, yet the Create Pull Request… option doesn't show. What am I missing?

screen shot 2016-05-10 at 2 25 12 pm

Has anyone verified this? I'm still seeing the same issue.

Can you dump the entire .git/config file for your repo here?

I replaced "sensitive" info with xxxx but here is it:

$ less .git/config 

[core]
        repositoryformatversion = 0
        filemode = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = [email protected]:xxxxxxxxx/xxxxxxxxxxxx-xxxxxxx
        projectname = xxxxxxxxxxxx-xxxxxxx
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "feature/driveTest"]
        remote = .
        merge = refs/heads/origin/feature/driveTest
[branch "bug/rotationNetworkErrorMessageBug"]
        remote = origin
[branch "bug/rotationNetworkErrorMessageBug"]
        merge = refs/heads/bug/rotationNetworkErrorMessageBug
[branch "feature/nextTestMessage"]
        remote = origin
[branch "feature/nextTestMessage"]
        merge = refs/heads/feature/nextTestMessage
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "debug/martin"]
        remote = origin
        merge = refs/heads/debug/martin
[user]
        name = Martin Marconcini
        email = [email protected]
[branch "task/ANDROID-1152-sdk-jni-loading"]
        remote = origin
        merge = refs/heads/task/ANDROID-1152-sdk-jni-loading
[branch "task/ANDROID-1155-Sdk-Configuration-builder"]
        remote = origin
        merge = refs/heads/task/ANDROID-1155-Sdk-Configuration-builder
[branch "refactor_settings_and_native_loader_for_sdk"]
        remote = origin
        merge = refs/heads/refactor_settings_and_native_loader_for_sdk
[branch "task/ANDROID-1139_create_xxxxxxx_instance"]
        remote = origin
        merge = refs/heads/task/ANDROID-1139_create_xxxxxxx_instance
[branch "origin/feature/driveTest"]
        remote = .
        merge = refs/heads/feature/driveTest
[branch "task/ANDROID-1157/implement_server_provider"]
        remote = origin
        merge = refs/heads/task/ANDROID-1157/implement_server_provider
[branch "task/ANDROID-1141/suite_listeners"]
        remote = origin
        merge = refs/heads/task/ANDROID-1141/suite_listeners
[branch "task/ANDROID-1142/sdk-reports"]
[branch "task/ANDROID-1133/license_request"]
        remote = origin
        merge = refs/heads/task/ANDROID-1133/license_request

Ok now what's the branch on whose tip you click and doesn't show the pull request option?

For example:
task/ANDROID-1133/license_request

screen shot 2016-05-26 at 12 28 05 pm

I don't see anything obvious, sorry. You would need to build GitUp locally, put a breakpoint on https://github.com/git-up/GitUp/blob/master/GitUpKit/Views/GIMapViewController.m#L455, show the contextual menu and step through the code.

I'm suspecting [self.repository hostingURLForRemoteBranch:branch service:&service error:NULL] returns nil for some reason...

Thanks. I guess there is _something_ strange going on. I've used the Create Pull Request feature in my previous project and it worked fine, I assumed this was because this repo has no "develop" but I'm not sure. I'll see if I can debug it, but it will have to wait a little bit, since that requires more effort :) Should this be re-opened?

@swisspol You are correct. I did that. hostingURLForRemoteBranch is nil
screen shot 2016-05-31 at 5 06 51 pm

I think I found the bug. It's here:

- (NSURL*)_projectHostingURLForRemote:(GCRemote*)remote service:(GCHostingService*)service error:(NSError**)error {
  NSString* value = GCGitURLFromURL(remote.URL);
  if (value == nil) {
    XLOG_DEBUG_UNREACHABLE();
    GC_SET_GENERIC_ERROR(@"Invalid remote URL");
    return nil;
  }
  if ([value hasSuffix:@".git"]) {

The repo I'm working on, doesn't end in . git so this entire thing returns nil with a

GC_SET_GENERIC_ERROR(@"Origin remote on unknown service");
  return nil;

Which is why the above ends up being nil.

GitHub origins are supposed to be like [email protected]:git-up/git-up.github.io.git. If you just fix the origin in your .git/config as such, it should work fine.

Yes, I have renamed my .git/config [origin] to now include .git and it now works. I'd argue that gitHub origins _are supposed_ to include that .git because I asked 4 coworkers and 3 out of 4 didn't have their origins with .git (even tho all are github).

I don't know how this can happen, but none of them use Gitup and all use cmd line and / or Tower for Mac. (or a combination of both). I personally usually use cmd line + gitup and _rarely_ rely on Tower to get a different view at the tree/commit history.

In any case, I'm tempted to say that it's a bug, but it should be _fixed_ or documented by someone with more experience in the consequences of touching that logic. :)

Thanks for your help tho.

If you copy-paste the origin URL from GitHub itself, it ends in .git. Ending in .git is not required but it's the convention to indicate the remote repo is a bare repo (and typically a server) - see http://stackoverflow.com/questions/8686691/what-does-the-git-mean-in-a-git-url.

Good to know and thanks for opening an issue for it. If anything, it's confusing (and not obvious) to the enduser why there's no pull request option. 👍 Thanks!

The reason for the silent failure is that it's hard to show a modal error dialog resulting from a internal call while the app is populating a menu 😞

Yeah, I get it. Maybe the Pull Request Option should be grayed out (or show the error once used?)

Just tossing bad ideas

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lolgear picture lolgear  ·  5Comments

jwiegley picture jwiegley  ·  6Comments

brandedoutcast picture brandedoutcast  ·  3Comments

zmc picture zmc  ·  7Comments

swisspol picture swisspol  ·  3Comments