Skip to content

Commit 5493b77

Browse files
Merge pull request #1321 from alexjfisher/dirty_debug
Fix dirty working tree debug logging
2 parents a26925b + e7d900f commit 5493b77

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.mkd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ CHANGELOG
44
Unreleased
55
----------
66

7+
- Fix dirty working copy debug logging [#1321](https://github.com/puppetlabs/r10k/pull/1321)
8+
79
3.15.2
810
------
911
- Implement exclude regex for puppetfile install [#1248](https://github.com/puppetlabs/r10k/issues/1248)

lib/r10k/git/shellgit/working_repository.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def dirty?(exclude_spec=false)
9494
result = git(['diff-index', '--exit-code', '--name-only', 'HEAD'], :path => @path.to_s, :raise_on_fail => false)
9595

9696
if result.exit_code != 0
97-
dirty_files = result.stdout.split('\n')
97+
dirty_files = result.stdout.split("\n")
9898
dirty_files.delete_if { |f| f.start_with?('spec/') } if exclude_spec
9999

100100
dirty_files.each do |file|

spec/shared-examples/git/working_repository.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,13 @@
194194
context "with local changes" do
195195
before(:each) do
196196
File.open(File.join(subject.path, 'README.markdown'), 'a') { |f| f.write('local modifications!') }
197+
File.open(File.join(subject.path, 'CHANGELOG'), 'a') { |f| f.write('local modifications to the changelog too') }
197198
end
198199

199200
it "logs and reports worktree as dirty" do
200201
expect(subject.logger).to receive(:debug).with(/found local modifications in.*README\.markdown/i)
201-
expect(subject.logger).to receive(:debug1)
202+
expect(subject.logger).to receive(:debug).with(/found local modifications in.*CHANGELOG/i)
203+
expect(subject.logger).to receive(:debug1).twice
202204

203205
expect(subject.dirty?).to be true
204206
end

0 commit comments

Comments
 (0)