Skip to content
Snippets Groups Projects
Commit 67419ea6 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg Committed by Robert Speicher
Browse files

Remove diff_text method

parent 6ace4360
No related branches found
No related tags found
1 merge request!84Remove diff_text method
Pipeline #
Loading
Loading
@@ -400,17 +400,6 @@ module Gitlab
DiffCollection.new(diff_patches(from, to, options, *paths), options)
end
 
# Return the diff between +from+ and +to+ in a single patch string. The
# +options+ hash has the same allowed keys as #diff.
def diff_text(from, to, options = {}, *paths)
# NOTE: It would be simpler to use the Rugged::Diff#patch method, but
# that formats the diff text differently than Rugged::Patch#to_s for
# changes to binary files.
diff_patches(from, to, options, *paths).map do |p|
p.to_s
end.join("\n")
end
# Returns commits collection
#
# Ex.
Loading
Loading
Loading
Loading
@@ -524,32 +524,6 @@ describe Gitlab::Git::Repository do
end
end
 
describe "#diff_text" do
let(:repo) { Gitlab::Git::Repository.new(TEST_MUTABLE_REPO_PATH) }
it "should contain the same diffs as #diff" do
diff_text = repo.diff_text("master", "feature")
diff_text = encode_utf8(diff_text)
repo.diff("master", "feature").each do |single_diff|
expect(diff_text.include?(single_diff.diff)).to be_truthy
end
end
it "should restrict its output to +paths+" do
diff_text = repo.diff_text("master", "feature", nil, "files")
repo.rugged.diff("master", "feature").each_delta do |delta|
path = delta.old_file[:path]
match_text = "diff --git a/#{path}"
if path.match(/^files/)
expect(diff_text).to include(match_text)
else
expect(diff_text).not_to include(match_text)
end
end
end
end
describe "#log" do
commit_with_old_name = nil
commit_with_new_name = nil
Loading
Loading
@@ -903,10 +877,6 @@ index 0000000..e69de29
result = repository.mkdir(path, commit_options)
expect(result).not_to eq(nil)
 
diff_text = repository.diff_text("#{result}~1", result)
expected = generate_diff_for_path(expected_path)
expect(diff_text).to eq(expected)
# Verify another mkdir doesn't create a directory that already exists
expect{ repository.mkdir(path, commit_options) }.to raise_error('Directory already exists')
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment