mislav / hub

A command-line tool that makes git easier to use with GitHub.
https://hub.github.com/
MIT License
22.81k stars 2.2k forks source link

Crash report - runtime error: index out of range #858

Closed yuuki-arc closed 9 years ago

yuuki-arc commented 9 years ago

Error (runtime.errorString): runtime error: index out of range

Stack:

goroutine 1 [running]:
github.com/github/hub/git.gitGetConfig(0xc2080818b8, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/git/git.go:180 +0x3d6
github.com/github/hub/git.Config(0x47f530, 0x8, 0x0, 0x0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/git/git.go:162 +0xc6
github.com/github/hub/github.knownGitHubHosts(0xc20801f220, 0x2, 0x2)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/github/hosts.go:31 +0x231
github.com/github/hub/github.NewProjectFromURL(0xc2080113b0, 0x0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/github/project.go:105 +0x4b
github.com/github/hub/github.ParseURL(0x7fff5fbff302, 0xe, 0x1, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/github/url.go:28 +0x89
github.com/github/hub/commands.transformMergeArgs(0xc2080581b0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/commands/merge.go:44 +0xca
github.com/github/hub/commands.merge(0x688120, 0xc2080581b0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/commands/merge.go:32 +0x40
github.com/github/hub/commands.(*Command).Call(0x688120, 0xc2080581b0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/commands/commands.go:46 +0x189
github.com/github/hub/commands.(*Runner).Call(0xc208029120, 0x688120, 0xc2080581b0, 0x0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/commands/runner.go:89 +0x54
github.com/github/hub/commands.(*Runner).Execute(0xc208029120, 0x0, 0x0, 0x0)
    /var/folders/w8/dp0lmdjs2vs51lsxbrf4s49h0000gn/T/go/src/github.com/github/hub/commands/runner.go:81 +0x215
main.main()
    /private/tmp/hub-xGkPdT/hub-2.2.0/main.go:12 +0x40

Runtime:

GOOS: darwin
GOARCH: amd64
mislav commented 9 years ago

Thanks for reporting. Which is the command you were trying to run when the crash happened? Is this similar to #856?

yuuki-arc commented 9 years ago

Commandline like:

$ git merge origin/master
$ git checkout master

Running:

$ git version
git version 2.3.5
hub version 2.2.0
mislav commented 9 years ago

Thanks. Do git merge origin/master and git checkout master fail every time with "index out of range" when you run them? This sounds serious. /cc @jingweno

owenthereal commented 9 years ago

I think the problem comes from an empty hub.host config. @yuuki-arc could you check your git config?

$ git config hub.host

I think it should be empty hence causing the runtime exception.

@mislav I provided a fix in https://github.com/github/hub/pull/860.

owenthereal commented 9 years ago

@yuuki-arc The fixes have been merged. You could either build from the latest master or remove the empty hub.host config.

yuuki-arc commented 9 years ago

@jingweno hub.host config is empty. Commandline was successful, when it removed. Thank you!