Skip to content

`fetch` broken when fork is of a different name #265

Open
RsrchBoy opened this Issue Nov 25, 2012 · 3 comments

2 participants

@RsrchBoy

e.g.

# repo: ghedo/p5-Dist-Zilla-Plugin-GitHub
$ hub fetch doherty
fatal: 'doherty' does not appear to be a git repository
fatal: Could not read from remote repository.

Note that doherty's repo is named "Dist-Zilla-Plugin-GitHub", i.e. without the "p5-" prefix.

@mislav
GitHub member
mislav commented Nov 25, 2012

I had a fear that different-named forks will confuse hub's commands. Seems like you got bitten by this.

Yes, hub is definitely broken in this regard, but the only fix I can think of is to scan the list of doherty's forks for the one that's a direct fork of "ghedo/p5-Dist-Zilla-Plugin-GitHub". This might slow the command down a little bit, but is the simplest way I can think of.

Thoughts?

@mislav
GitHub member
mislav commented Nov 25, 2012

Actually, I am confused. You should have seen a hub error when you tried hub fetch, not a git fatal error.

Are you on the latest version of hub?

(Not that the scenario is going to work; it's just that you should have gotten a more descriptive error.)

@RsrchBoy

I believe I'm using the latest hub (standalone); I'd pulled down a couple days ago.

athena ~ » hub --version
git version 1.8.0
hub version 1.10.3

This is what I'm seeing if I freshly clone the source, and then try to add and fetch the fork:

rsrchboy at athena in /tmp
athena /tmp » hub clone ghedo/p5-Dist-Zilla-Plugin-GitHub 
Cloning into 'p5-Dist-Zilla-Plugin-GitHub'...
remote: Counting objects: 847, done.
remote: Compressing objects: 100% (485/485), done.
remote: Total 847 (delta 176), reused 834 (delta 163)
Receiving objects: 100% (847/847), 92.89 KiB | 149 KiB/s, done.
Resolving deltas: 100% (176/176), done.
rsrchboy at athena in /tmp

athena /tmp » cd p5-Dist-Zilla-Plugin-GitHub 
rsrchboy at athena in /tmp/p5-Dist-Zilla-Plugin-GitHub

athena /tmp/p5-Dist-Zilla-Plugin-GitHub ‹master› » hub fetch doherty
fatal: 'doherty' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

rsrchboy at athena in /tmp/p5-Dist-Zilla-Plugin-GitHub
athena /tmp/p5-Dist-Zilla-Plugin-GitHub ‹master› » git remote -v
origin  git://github.com/ghedo/p5-Dist-Zilla-Plugin-GitHub.git (fetch)
origin  git://github.com/ghedo/p5-Dist-Zilla-Plugin-GitHub.git (push)

In a choice between speed and avoiding the occasional edge case, in this instance I'd choose avoidance. (Or falling back to doing a full scan on error.) But I've also been bitten by this a couple times in the last week (and never before that), so I might be a bit biased here. ...actually, I hadn't even realized that one could rename a fork.

Looking at this repo's network, it actually looks like the source was renamed, as the 5 forks all have the same name. So that's.... interesting. I don't know what implications that may have for hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.