Skip to content

Commit

Permalink
Fix comma-separated fetch with more than 2 names
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Aug 16, 2016
1 parent 01dad76 commit eda119e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion commands/fetch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package commands

import (
"fmt"
"regexp"
"strings"

Expand Down Expand Up @@ -80,7 +81,8 @@ func parseRemoteNames(args *Args) (names []string) {
}
} else if len(words) > 0 {
remoteName := words[0]
remoteNameRegexp := regexp.MustCompile("^\\w+(,\\w+)$")
commaPattern := fmt.Sprintf("^%s(,%s)+$", OwnerRe, OwnerRe)
remoteNameRegexp := regexp.MustCompile(commaPattern)
if remoteNameRegexp.MatchString(remoteName) {
i := args.IndexOfParam(remoteName)
args.RemoveParam(i)
Expand Down
5 changes: 3 additions & 2 deletions features/fetch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ Feature: hub fetch
"""
get('/repos/:owner/dotfiles') { json :private => false }
"""
When I successfully run `hub fetch mislav,rtomayko`
Then "git fetch --multiple mislav rtomayko" should be run
When I successfully run `hub fetch mislav,rtomayko,dustinleblanc`
Then "git fetch --multiple mislav rtomayko dustinleblanc" should be run
And the url for "mislav" should be "git://github.com/mislav/dotfiles.git"
And the url for "rtomayko" should be "git://github.com/rtomayko/dotfiles.git"
And the url for "dustinleblanc" should be "git://github.com/dustinleblanc/dotfiles.git"

Scenario: Doesn't create a new remote if repo doesn't exist on GitHub
Given the GitHub API server:
Expand Down

0 comments on commit eda119e

Please sign in to comment.