braid 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b07263a1d13718243281be9924f86bf3400e792
4
- data.tar.gz: 1a7ea97cf3b02b08013b19daefb97ebe29466b37
3
+ metadata.gz: e697a371543e509b5d87a65d9d115a926ea473bf
4
+ data.tar.gz: 6d3c3bcf1b6e0d8ffc03e9aa96895c31a759f52d
5
5
  SHA512:
6
- metadata.gz: 136b4a010e5774c520d55b94e9fb3a6452132ba27d0f7c4dec37574d0824232be0b31b4e23a55ca330f7a816880cd84f60f3789f91bf8d3d695d82fb0b776ca8
7
- data.tar.gz: ed0f139ec17aff47b990dd6d26187b1e3b0bda166a311a20d68f6f329f0ee7340194fcfbc57472b564ff4a94f9e82229779cfd084681413a3cdc3adf7fab3d56
6
+ metadata.gz: cb691eb77d96fe8944a0723ec7f083ca6d8188b228d1ce1da97c92e6b7c0e41211237eef194785feebcc6ab5c8e27f5f34996ca22210e2d495ac15abcc1ca0f4
7
+ data.tar.gz: b0b2a74a470aa04a145b75833bcb889d1b4e1130b050168a185c665e454f01a524f9da282c61320f8969f2830a40a0c3beefcaa37ca841d6648a4d4d1835bb62
@@ -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
- git.rev_parse(mirror.local_ref)
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'
@@ -1,3 +1,3 @@
1
1
  module Braid
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -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')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristi Balan