qualmzy 0.1.1 → 0.1.3

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
  SHA256:
3
- metadata.gz: e5713a5989edba9528033bc543711354308b232fa92156a82e9032ef5671feab
4
- data.tar.gz: 2005ed282e4889f193e146f7873d8f35605fe55f6aa6688581c16477e477707f
3
+ metadata.gz: da039bd935c10929740c00d131d0a453c387affd2904c80cbfcf1fde225e7f52
4
+ data.tar.gz: afa835938ba088eefae80b66f756a9e87a28f83f1e790122f1c6abd017bb63ab
5
5
  SHA512:
6
- metadata.gz: 5f31a92b05ddd3548033d755dabfb93a7cdd1ce31d7d0459e45ed40cf97dfc7f8cd0eeb8e122d71d8aebd6ddc8265b20a7f24e818b3870c27b0abf66601c42f9
7
- data.tar.gz: 5f75db7c211f29353ef1a16c827a2f85bf1e3b6e4f29f0e6ca6f103e847b859dd0ead0651d18deb155d2a8f5b05e0446e038f5fc5756c6704af77a4fb134e948
6
+ metadata.gz: ba177ffef9a4c56702faa01053657fd184c9380206f32b0a5f6e401d836335c0df9d8aa9505fa55dbb147bf8cb1310e5fa2539cf9dcc9e5ed252fa787e185c8c
7
+ data.tar.gz: '080fe79013ccf40f99ca171412c4b8c78cfb6a75df61fa29ab098cee9edda90fc75b9f538edd948b91d5c0bbe7a86ef6b105dbf3974ce35677afa3e64dd3efec'
@@ -47,9 +47,9 @@ module Qualmzy
47
47
  args = [*PINNED, base, "--", change.path]
48
48
  git(*args, allow: [1]).stdout
49
49
  end
50
+ return Diff.new("", true, false) if raw.lines.any? { |line| line.start_with?("Binary files ") || line.start_with?("GIT binary patch") }
50
51
  text = normalize(raw)
51
52
  return Diff.new(text, false, false) unless text.empty?
52
- return Diff.new("", true, false) if raw.lines.any? { |line| line.start_with?("Binary files ") || line.start_with?("GIT binary patch") }
53
53
  return Diff.new("", false, true) if raw.empty? || raw.include?("similarity index 100%") || raw.match?(/^old mode /)
54
54
  raise Error, "could not read diff for #{change.path}"
55
55
  rescue Errno::ENOENT
@@ -90,7 +90,7 @@ module Qualmzy
90
90
  CommandResult.new(stdout, status.success?)
91
91
  end
92
92
  def resolve(ref)
93
- result = git("rev-parse", "--verify", "--quiet", "--end-of-options", "#{ref}^{commit}", allow: [128])
93
+ result = git("rev-parse", "--verify", "--quiet", "--end-of-options", "#{ref}^{commit}", allow: [1, 128])
94
94
  result.success? ? result.stdout.strip : nil
95
95
  end
96
96
  def parse_tracked(base)
@@ -118,14 +118,14 @@ module Qualmzy
118
118
  File.exist?(File.join(@dir, path)) || git("cat-file", "-e", "#{base}:./#{path}", allow: [128]).success?
119
119
  end
120
120
  def normalize(raw)
121
- raw.lines.reject { |line| line.start_with?("diff --git ", "index ", "--- ", "+++ ", "old mode ", "new mode ", "new file mode ", "deleted file mode ", "similarity index ", "rename from ", "rename to ") }.join
121
+ text = raw.lines.reject { |line| line.start_with?("diff --git ", "index ", "--- ", "+++ ", "old mode ", "new mode ", "new file mode ", "deleted file mode ", "similarity index ", "rename from ", "rename to ") }.join
122
+ text.force_encoding(Encoding::UTF_8).scrub { |bytes| bytes.bytes.map { |byte| format('\\x%02X', byte) }.join }
122
123
  end
123
124
  def unified_for_untracked(path, content)
125
+ return "Binary files /dev/null and b/#{path} differ\n" if content.include?("\0")
124
126
  lines = content.force_encoding(Encoding::UTF_8).lines
125
127
  return "" if lines.empty?
126
128
  "@@ -0,0 +1,#{lines.length} @@\n" + lines.map { |line| "+#{line}" }.join
127
- rescue Encoding::InvalidByteSequenceError
128
- "Binary files /dev/null and b/#{path} differ\n"
129
129
  end
130
130
  end
131
131
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Qualmzy
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qualmzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - qualmzy contributors