Skip to content
Snippets Groups Projects
Commit fbff27f5 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg
Browse files

Remove commit#to_diff and commit#to_patch

These methods will be unused when gitlab-org/gitlab-ce!5367 is merged,
therefor not needed here.
parent 37c5c24c
No related branches found
No related tags found
1 merge request!105WIP: Remove commit#to_diff and commit#to_patch
Pipeline #
v 10.5.0 (unreleased)
- Remove commit#to_diff and commit#to_patch
v 10.4.0
- Move implementation of `local_branches` to `Gitlab::Git::Repository` from gitlab-ce
- Refactor Refs to preserve their target objects instead of just a string representation
Loading
Loading
Loading
Loading
@@ -175,13 +175,6 @@ module Gitlab
parent_ids.first
end
 
# Shows the diff between the commit's parent and the commit.
#
# Cuts out the header and stats from #to_patch and returns only the diff.
def to_diff(options = {})
diff_from_parent(options).patch
end
# Returns a diff object for the changes from this commit's first parent.
# If there is no parent, then the diff is between this commit and an
# empty repo. See Repository#diff for keys allowed in the +options+
Loading
Loading
@@ -226,16 +219,6 @@ module Gitlab
Gitlab::Git::CommitStats.new(self)
end
 
def to_patch(options = {})
begin
raw_commit.to_mbox(options)
rescue Rugged::InvalidError => ex
if ex.message =~ /Commit \w+ is a merge commit/
'Patch format is not currently supported for merge commits.'
end
end
end
# Get a collection of Rugged::Reference objects for this commit.
#
# Ex.
Loading
Loading
Loading
Loading
@@ -336,24 +336,10 @@ describe Gitlab::Git::Commit do
end
end
 
describe :to_diff do
subject { commit.to_diff }
it { is_expected.not_to include "From #{SeedRepo::Commit::ID}" }
it { is_expected.to include 'diff --git a/files/ruby/popen.rb b/files/ruby/popen.rb'}
end
describe :has_zero_stats? do
it { expect(commit.has_zero_stats?).to eq(false) }
end
 
describe :to_patch do
subject { commit.to_patch }
it { is_expected.to include "From #{SeedRepo::Commit::ID}" }
it { is_expected.to include 'diff --git a/files/ruby/popen.rb b/files/ruby/popen.rb'}
end
describe :to_hash do
let(:hash) { commit.to_hash }
subject { hash }
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