dco 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4042d36b9143f9362c730993c832d62ca63eaa4
4
- data.tar.gz: 96077d5e9ba80c887785f2b48ae3e3200e9f5a12
3
+ metadata.gz: f839540539866426b2c722e80c2a72c907a9cb38
4
+ data.tar.gz: c8f73facb60d4e5c0afc3ecdbf3032e99aa35b4f
5
5
  SHA512:
6
- metadata.gz: 2d5bf65726338dfe996282d97fe321a1e2b7b63bdc24d96ffe38771db1d053f422fe98ff68e5d0b095bfa7fe0edcc20e2eb72bc66dcb4f4cac5a675d01bc862f
7
- data.tar.gz: 94aca9b9c75faa86b99f046d063da9a63343f28fb13d65a5af83bb2add7cfb1ef5b4f29abceafc2814d35d30c0affb8f350046b462e51f3f27864cfdf7a63d59
6
+ metadata.gz: f77eb6ce065e377e3a426d2561894d7c683fff67589f31f83d80d08a3451280e905d0d8bc4ec08cbc8f36efc0be003166ad037a94a184e86791ae128397d0c3e
7
+ data.tar.gz: a00efa56e1b0447ec1f75c6113fe2691d89740fcd0e13da05a23995cce43e543536bf377869852f3efd3e17bbf737e26ace767ff63ba037453adad2c88a6daa5
@@ -1,5 +1,10 @@
1
1
  # DCO Changelog
2
2
 
3
+ ## v1.0.1
4
+
5
+ * Fix `dco sign` when there is a backup ref from a different branch than the
6
+ current one.
7
+
3
8
  ## v1.0.0
4
9
 
5
10
  * Initial release!
@@ -196,16 +196,17 @@ EOH
196
196
  end
197
197
 
198
198
  # First check for a stored ref under refs/original/.
199
- begin
200
- repo.show("refs/original/refs/heads/#{branch}")
201
- # If this doesn't error, a backup ref is present.
202
- unless confirm?("An existing backup of branch #{branch} is present from a previous filter-branch. Do you want to remove this backup and continue? [yes/no]")
203
- raise Thor::Error.new('Backup ref present, not continuing')
204
- end
205
- # Clear the backup.
206
- File.unlink(".git/refs/original/refs/heads/#{branch}")
207
- rescue Git::GitExecuteError
208
- # This means there was no backup, keep going.
199
+ backup_refs = Dir[File.join(repo.repo.path, 'refs/original/refs/heads/*')]
200
+ backup_refs_label = if backup_refs.size > 1
201
+ "branches #{backup_refs.map {|p| File.basename(p) }.join(', ')} are"
202
+ else
203
+ "branch #{backup_refs.first} is"
204
+ end
205
+ unless backup_refs.empty? || confirm?("An existing backup of #{backup_refs_label} present from a previous filter-branch. Do you want to remove this backup and continue? [yes/no]")
206
+ raise Thor::Error.new('Backup ref present, not continuing')
207
+ end
208
+ backup_refs.each do |ref|
209
+ File.unlink(ref)
209
210
  end
210
211
 
211
212
  # Next examine all the commits we will be touching.
@@ -17,5 +17,5 @@
17
17
 
18
18
  module Dco
19
19
  # dco gem version.
20
- VERSION = '1.0.0'
20
+ VERSION = '1.0.1'
21
21
  end
@@ -201,6 +201,25 @@ describe 'dco sign' do
201
201
  end
202
202
  end # /context with an existing backup pointer
203
203
 
204
+ context 'with an existing backup pointer from a different branch' do
205
+ before do
206
+ command 'echo three > testing && git commit -a -m "first branch commit"'
207
+ dco_command 'sign -y mybranch'
208
+ command 'git checkout -b mybranch2 && echo four > testing && git commit -a -m "second branch commit"'
209
+ end
210
+ dco_command 'sign -y mybranch2'
211
+
212
+ it do
213
+ expect(subject.exitstatus).to eq 0
214
+ expect(subject.stdout).to match /^Developer's Certificate of Origin 1\.1$/
215
+ expect(subject.stdout).to match /^Going to sign-off the following commits:\n\* \h{7} Alan Smithee <asmithee@example\.com> second branch commit$/
216
+ expect(repo.log[0].message).to eq "second branch commit\n\nSigned-off-by: Alan Smithee <asmithee@example.com>"
217
+ expect(repo.log[1].message).to eq "first branch commit\n\nSigned-off-by: Alan Smithee <asmithee@example.com>"
218
+ expect(repo.log[2].message).to eq "second commit"
219
+ expect(repo.log[3].message).to eq "first commit"
220
+ end
221
+ end # /context with an existing backup pointer from a different branch
222
+
204
223
  context 'with an existing backup pointer without -y' do
205
224
  before do
206
225
  command 'echo three > testing && git commit -a -m "first branch commit"'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dco
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz