Permalink
Browse files

Merge pull request #1653 from github/detect-pushable-forks

Have `fetch` use writable push URL for writeable fork
  • Loading branch information...
2 parents 0ebd0fc + 3cce40c commit 96a68cf1dcbc171a2be32662479ff48ab59c7c75 @mislav mislav committed Jan 19, 2018
Showing with 18 additions and 2 deletions.
  1. +1 −1 commands/fetch.go
  2. +17 −1 features/fetch.feature
View
@@ -61,7 +61,7 @@ func transformFetchArgs(args *Args) error {
continue
}
- projects[project] = repo.Private
+ projects[project] = repo.Private || repo.Permissions.Push
}
}
}
View
@@ -35,7 +35,10 @@ Feature: hub fetch
Scenario: Creates new remote
Given the GitHub API server:
"""
- get('/repos/mislav/dotfiles') { json :private => false }
+ get('/repos/mislav/dotfiles') {
+ json :private => false,
+ :permissions => { :push => false }
+ }
"""
When I successfully run `hub fetch mislav`
Then "git fetch mislav" should be run
@@ -72,6 +75,19 @@ Feature: hub fetch
And the url for "mislav" should be "git@github.com:mislav/dotfiles.git"
And there should be no output
+ Scenario: Writeable repo
+ Given the GitHub API server:
+ """
+ get('/repos/mislav/dotfiles') {
+ json :private => false,
+ :permissions => { :push => true }
+ }
+ """
+ When I successfully run `hub fetch mislav`
+ Then "git fetch mislav" should be run
+ And the url for "mislav" should be "git@github.com:mislav/dotfiles.git"
+ And there should be no output
+
Scenario: Fetch with options
Given the GitHub API server:
"""

0 comments on commit 96a68cf

Please sign in to comment.