[#MODULES-1201] spec helper cannot check out git branches

advertisement
[MODULES-1201] spec helper cannot check out git branches Created: 2014/07/08
Updated:
2015/09/30 Resolved: 2015/09/30
Status:
Project:
Component/s:
Affects
Version/s:
Fix Version/s:
Resolved
Forge Modules
spec_helper
None
Type:
Reporter:
Resolution:
Labels:
Remaining
Estimate:
Time Spent:
Original
Estimate:
Environment:
Bug
Robin Bowes
Fixed
spec_helper
Not Specified
Template:
customfield_10700 true
None
Priority:
Assignee:
Votes:
Normal
Unassigned
3
Not Specified
Not Specified
OSx under bundler
Description
I have the following in my .fixtures.yml:
fixtures:
repositories:
stdlib: 'https://github.com/puppetlabs/puppetlabsstdlib.git'
cxtool:
repo: 'whgit:modules/cxtool.git'
ref: 'feature/cell_config'
symlinks:
profile_cxtool: "#{source_dir}"
Running "bundle exec rake spec" fails with this error:
fatal: ambiguous argument 'feature/cell_config': unknown revision or path not in the working
tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] – [<file>...]'
Looking at the spec helper code, it seems the command that is being issued is:
git reset --hard feature/cell_config
This does indeed fail unless the branch "feature/cell_config" has already been checked out
locally, which it won't have been when it's first cloned.
Comments
Comment by Aaron Hicks [ 2014/07/13 ]
I've observed this issue as well, with a different .fixtures.yml
https://github.com/Aethylred/puppetgitlab/blob/9bbaa90f254df21fc59a8172dcca707086f72661/.fixtures.yml
Giving the following output on Travis:
https://travis-ci.org/Aethylred/puppet-gitlab/jobs/29857848
Comment by Aaron Hicks [ 2014/07/14 ]
Hmm, I'm not sure if these are exactly the same issue, but I think if the reset command specified
that the reset was against the remote (origin unless otherwise specified) it might resolve these.
For example:
```
git reset --hard origin/<reference>
```
Not entirely sure how to make that work with the original case reported by Robin Bowes as the
git reference given does not seem to meet any of the forms described in the git documentation
http://git-scm.com/book/en/Git-Tools-Revision-Selection
Comment by Aaron Hicks [ 2014/07/14 ]
Bingo, changing the offending repository in my .fixtures.yml to:
repositories:
ruby:
repo: 'git://github.com/Aethylred/puppetlabs-ruby.git'
ref: 'origin/rakebundle'
solved the problem for me.
I think some kind of validation of the repository reference is necessary, though only the /
character might be causing issues.
Comment by Robin Bowes [ 2014/07/14 ]
The git reference I am using in that instance is a branch name, as generated with git-flow
defaults.
I haven't got the same branch available in that repo, but here's another one:
$ git branch

develop
feature/stack_role_nodes
master
R.
Comment by Aaron Hicks [ 2014/07/14 ]
What happens when you specify the reference as:
cxtool:
repo: 'whgit:modules/cxtool.git'
ref: 'origin/feature/cell_config'
Comment by Jason Antman [ 2014/10/23 ]
I'm seeing this too, under Linux with 0.8.2. It appears that it's an issue with handling branches
that haven't been checked out locally.
What I'm seeing is:
(1) if the module isn't currently in fixtures (i.e. after running spec_clean), the check out works
for a branch
(2) if the fixture is already there, it attempts to run `git reset --hard #
{ref}
`, which fails if `ref` is a branch that hasn't been checked out yet
(3) if I change `ref` from "somebranch" to "remotes/origin/somebranch", it seems to work, but
only if I do a spec_clean first.
Generated at Sat Mar 05 23:39:30 PST 2016 using JIRA 6.4.12#64027sha1:e3691cc1283c0f3cef6d65d3ea82d47743692b57.
Download