diff --git a/commands/fetch.go b/commands/fetch.go index c9c7c5b3b..5cffaab6f 100644 --- a/commands/fetch.go +++ b/commands/fetch.go @@ -1,6 +1,7 @@ package commands import ( + "fmt" "regexp" "strings" @@ -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) diff --git a/features/fetch.feature b/features/fetch.feature index 3a92b2f8f..22d28f541 100644 --- a/features/fetch.feature +++ b/features/fetch.feature @@ -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: