diff --git a/CHANGELOG b/CHANGELOG index 4c2694f13fe7da3fb743185d98d651d957a5892e..4d5c67276b569b070736aa8b75422b46f21fc1b1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +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 diff --git a/lib/gitlab_git/commit.rb b/lib/gitlab_git/commit.rb index 8137934c413832b7407b3f5e8441a5ccea2da647..f5444865c0dc0b8f8910b0199f8b93c54a5c4e38 100644 --- a/lib/gitlab_git/commit.rb +++ b/lib/gitlab_git/commit.rb @@ -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+ @@ -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. diff --git a/spec/commit_spec.rb b/spec/commit_spec.rb index e7a003bc610f9c7e720373db18fdedc9161623ad..6e37737e71ccfc06ed0ddadd191e547bb908c493 100644 --- a/spec/commit_spec.rb +++ b/spec/commit_spec.rb @@ -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 }