2012-05-06 21:29:50 +04:00
|
|
|
Feature: hub fetch
|
|
|
|
Background:
|
|
|
|
Given I am in "dotfiles" git repo
|
|
|
|
And the "origin" remote has url "git://github.com/evilchelu/dotfiles.git"
|
|
|
|
And I am "mislav" on github.com with OAuth token "OTOKEN"
|
|
|
|
|
|
|
|
Scenario: Fetch existing remote
|
|
|
|
When I successfully run `hub fetch origin`
|
2016-01-22 13:13:45 +03:00
|
|
|
Then the git command should be unchanged
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2012-05-06 21:29:50 +04:00
|
|
|
|
2016-08-14 21:33:14 +03:00
|
|
|
Scenario: Fetch existing remote from non-GitHub source
|
|
|
|
Given the "origin" remote has url "ssh://dev@codeserver.dev.xxx.drush.in/~/repository.git"
|
|
|
|
When I successfully run `hub fetch origin`
|
|
|
|
Then the git command should be unchanged
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2016-08-14 21:33:14 +03:00
|
|
|
|
2016-09-08 15:29:44 +03:00
|
|
|
Scenario: Fetch from non-GitHub source via refspec
|
|
|
|
Given the "origin" remote has url "ssh://dev@codeserver.dev.xxx.drush.in/~/repository.git"
|
|
|
|
When I successfully run `hub fetch ssh://myusername@a.specific.server:1234/existing-project/gerrit-project-name refs/changes/16/6116/1`
|
|
|
|
Then the git command should be unchanged
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2016-09-08 15:29:44 +03:00
|
|
|
|
2016-01-22 13:13:45 +03:00
|
|
|
Scenario: Fetch from local bundle
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-29 19:17:14 +03:00
|
|
|
get('/repos/mislav/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2016-01-22 13:13:45 +03:00
|
|
|
"""
|
|
|
|
And a git bundle named "mislav"
|
|
|
|
When I successfully run `hub fetch mislav`
|
|
|
|
Then the git command should be unchanged
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2016-01-22 13:13:45 +03:00
|
|
|
And there should be no "mislav" remote
|
|
|
|
|
2012-05-06 21:29:50 +04:00
|
|
|
Scenario: Creates new remote
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-19 17:49:46 +03:00
|
|
|
get('/repos/mislav/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-06 21:29:50 +04:00
|
|
|
"""
|
|
|
|
When I successfully run `hub fetch mislav`
|
|
|
|
Then "git fetch mislav" should be run
|
2022-03-25 19:46:40 +03:00
|
|
|
And the url for "mislav" should be "https://github.com/mislav/dotfiles.git"
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2012-05-06 21:29:50 +04:00
|
|
|
|
2022-03-25 19:46:40 +03:00
|
|
|
Scenario: Creates new remote with git
|
|
|
|
Given git protocol is preferred
|
2013-03-12 18:26:50 +04:00
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2022-03-25 19:46:40 +03:00
|
|
|
get('/repos/mislav/dotfiles') {
|
2018-01-29 19:17:14 +03:00
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2013-03-12 18:26:50 +04:00
|
|
|
"""
|
2022-03-25 19:46:40 +03:00
|
|
|
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"
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2013-03-12 18:26:50 +04:00
|
|
|
|
2022-03-25 19:46:40 +03:00
|
|
|
Scenario: Owner name with dash
|
2012-05-06 21:29:50 +04:00
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2022-03-25 19:46:40 +03:00
|
|
|
get('/repos/ankit-maverick/dotfiles') {
|
2018-01-29 19:17:14 +03:00
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-06 21:29:50 +04:00
|
|
|
"""
|
2022-03-25 19:46:40 +03:00
|
|
|
When I successfully run `hub fetch ankit-maverick`
|
|
|
|
Then "git fetch ankit-maverick" should be run
|
|
|
|
And the url for "ankit-maverick" should be "https://github.com/ankit-maverick/dotfiles.git"
|
|
|
|
And the output should not contain anything
|
2012-05-06 21:29:50 +04:00
|
|
|
|
2012-05-07 17:22:32 +04:00
|
|
|
Scenario: Private repo
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-29 19:17:14 +03:00
|
|
|
get('/repos/mislav/dotfiles') {
|
|
|
|
json :private => true,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-07 17:22:32 +04:00
|
|
|
"""
|
2022-03-25 19:46:40 +03:00
|
|
|
And git protocol is preferred
|
2012-05-07 17:22:32 +04:00
|
|
|
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"
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2012-05-07 17:22:32 +04:00
|
|
|
|
2018-01-19 17:49:46 +03:00
|
|
|
Scenario: Writeable repo
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => true }
|
|
|
|
}
|
|
|
|
"""
|
2022-03-25 19:46:40 +03:00
|
|
|
And git protocol is preferred
|
2018-01-19 17:49:46 +03:00
|
|
|
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"
|
2019-08-21 19:23:50 +03:00
|
|
|
And the output should not contain anything
|
2018-01-19 17:49:46 +03:00
|
|
|
|
2012-05-06 21:29:50 +04:00
|
|
|
Scenario: Fetch with options
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-29 19:17:14 +03:00
|
|
|
get('/repos/mislav/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-06 21:29:50 +04:00
|
|
|
"""
|
|
|
|
When I successfully run `hub fetch --depth=1 mislav`
|
|
|
|
Then "git fetch --depth=1 mislav" should be run
|
|
|
|
|
|
|
|
Scenario: Fetch multiple
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-29 19:17:14 +03:00
|
|
|
get('/repos/:owner/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-06 21:29:50 +04:00
|
|
|
"""
|
|
|
|
When I successfully run `hub fetch --multiple mislav rtomayko`
|
|
|
|
Then "git fetch --multiple mislav rtomayko" should be run
|
2022-03-25 19:46:40 +03:00
|
|
|
And the url for "mislav" should be "https://github.com/mislav/dotfiles.git"
|
|
|
|
And the url for "rtomayko" should be "https://github.com/rtomayko/dotfiles.git"
|
2012-05-06 21:29:50 +04:00
|
|
|
|
|
|
|
Scenario: Fetch multiple with filtering
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-29 19:17:14 +03:00
|
|
|
get('/repos/mislav/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-06 21:29:50 +04:00
|
|
|
"""
|
|
|
|
When I successfully run `git config remotes.mygrp "foo bar"`
|
2022-03-25 19:46:40 +03:00
|
|
|
When I successfully run `hub fetch --multiple origin mislav mygrp https://example.com typo`
|
|
|
|
Then "git fetch --multiple origin mislav mygrp https://example.com typo" should be run
|
|
|
|
And the url for "mislav" should be "https://github.com/mislav/dotfiles.git"
|
2012-05-06 21:29:50 +04:00
|
|
|
But there should be no "mygrp" remote
|
|
|
|
And there should be no "typo" remote
|
|
|
|
|
|
|
|
Scenario: Fetch multiple comma-separated
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
2018-01-29 19:17:14 +03:00
|
|
|
get('/repos/:owner/dotfiles') {
|
|
|
|
json :private => false,
|
|
|
|
:permissions => { :push => false }
|
|
|
|
}
|
2012-05-06 21:29:50 +04:00
|
|
|
"""
|
2016-08-14 23:02:54 +03:00
|
|
|
When I successfully run `hub fetch mislav,rtomayko,dustinleblanc`
|
|
|
|
Then "git fetch --multiple mislav rtomayko dustinleblanc" should be run
|
2022-03-25 19:46:40 +03:00
|
|
|
And the url for "mislav" should be "https://github.com/mislav/dotfiles.git"
|
|
|
|
And the url for "rtomayko" should be "https://github.com/rtomayko/dotfiles.git"
|
|
|
|
And the url for "dustinleblanc" should be "https://github.com/dustinleblanc/dotfiles.git"
|
2012-05-06 21:29:50 +04:00
|
|
|
|
|
|
|
Scenario: Doesn't create a new remote if repo doesn't exist on GitHub
|
|
|
|
Given the GitHub API server:
|
|
|
|
"""
|
|
|
|
get('/repos/mislav/dotfiles') { status 404 }
|
|
|
|
"""
|
|
|
|
When I successfully run `hub fetch mislav`
|
2016-01-22 13:13:45 +03:00
|
|
|
Then the git command should be unchanged
|
2012-05-06 21:29:50 +04:00
|
|
|
And there should be no "mislav" remote
|