From fbff27f5891138275e653a77f49948592b0df7d9 Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Thu, 21 Jul 2016 09:04:28 +0200 Subject: [PATCH] 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. --- CHANGELOG | 3 +++ lib/gitlab_git/commit.rb | 17 ----------------- spec/commit_spec.rb | 14 -------------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4c2694f..4d5c672 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 8137934..f544486 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 e7a003b..6e37737 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 } -- GitLab