braid 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/braid/command.rb +8 -3
- data/lib/braid/version.rb +1 -1
- data/spec/integration/adding_spec.rb +35 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e697a371543e509b5d87a65d9d115a926ea473bf
|
4
|
+
data.tar.gz: 6d3c3bcf1b6e0d8ffc03e9aa96895c31a759f52d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb691eb77d96fe8944a0723ec7f083ca6d8188b228d1ce1da97c92e6b7c0e41211237eef194785feebcc6ab5c8e27f5f34996ca22210e2d495ac15abcc1ca0f4
|
7
|
+
data.tar.gz: b0b2a74a470aa04a145b75833bcb889d1b4e1130b050168a185c665e454f01a524f9da282c61320f8969f2830a40a0c3beefcaa37ca841d6648a4d4d1835bb62
|
data/lib/braid/command.rb
CHANGED
@@ -114,13 +114,18 @@ module Braid
|
|
114
114
|
if mirror.tag
|
115
115
|
if use_local_cache?
|
116
116
|
Dir.chdir git_cache.path(mirror.url) do
|
117
|
-
|
117
|
+
# Dereference the tag to a commit since we want the `revision`
|
118
|
+
# attribute of a mirror to always be a commit object. This is also
|
119
|
+
# currently needed because we don't fetch annotated tags into the
|
120
|
+
# downstream repository, although we might change that in the
|
121
|
+
# future.
|
122
|
+
git.rev_parse(mirror.local_ref + "^{commit}")
|
118
123
|
end
|
119
124
|
else
|
120
125
|
raise BraidError, 'unable to retrieve tag version when cache disabled.'
|
121
126
|
end
|
122
127
|
else
|
123
|
-
git.rev_parse(mirror.local_ref)
|
128
|
+
git.rev_parse(mirror.local_ref + "^{commit}")
|
124
129
|
end
|
125
130
|
end
|
126
131
|
|
@@ -128,7 +133,7 @@ module Braid
|
|
128
133
|
if revision.nil?
|
129
134
|
determine_repository_revision(mirror)
|
130
135
|
else
|
131
|
-
new_revision = git.rev_parse(revision)
|
136
|
+
new_revision = git.rev_parse(revision + "^{commit}")
|
132
137
|
|
133
138
|
if new_revision == mirror.revision
|
134
139
|
raise InvalidRevision, 'mirror is already at requested revision'
|
data/lib/braid/version.rb
CHANGED
@@ -138,6 +138,41 @@ describe 'Adding a mirror in a clean repository' do
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
+
describe 'from an annotated tag in a git repository' do
|
142
|
+
before do
|
143
|
+
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
144
|
+
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
145
|
+
in_dir(@vendor_repository_dir) do
|
146
|
+
run_command('git tag -a -m "v1" v1')
|
147
|
+
end
|
148
|
+
|
149
|
+
in_dir(@repository_dir) do
|
150
|
+
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --tag v1")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'should add the files and commit' do
|
155
|
+
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
156
|
+
|
157
|
+
in_dir(@repository_dir) do
|
158
|
+
assert_commit_subject(/Braid: Add mirror 'skit1' at '[0-9a-f]{7}'/)
|
159
|
+
assert_commit_author('Some body')
|
160
|
+
assert_commit_email('somebody@example.com')
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'should create .braids.json and add the mirror to it' do
|
165
|
+
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
166
|
+
expect(braids['config_version']).to be_kind_of(Numeric)
|
167
|
+
mirror_obj = braids['mirrors']['skit1']
|
168
|
+
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
169
|
+
expect(mirror_obj['revision']).not_to be_nil
|
170
|
+
expect(mirror_obj['branch']).to be_nil
|
171
|
+
expect(mirror_obj['tag']).to eq('v1')
|
172
|
+
expect(mirror_obj['path']).to be_nil
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
141
176
|
describe 'from a revision in a git repository' do
|
142
177
|
before do
|
143
178
|
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|