From a09d93821521e8908c46a418471969999ab8a312 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Thu, 20 Dec 2012 13:31:09 +0100 Subject: Flipping commit ids in commits_between, fixes #513 --- app/models/commit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index 200c915a335..aa91bd546bd 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -92,7 +92,7 @@ class Commit older = commits.last result[:same] = (younger.id == older.id) - result[:commits] = project.repo.commits_between(younger.id, older.id).map {|c| Commit.new(c)} + result[:commits] = project.repo.commits_between(older.id, younger.id).map {|c| Commit.new(c)} result[:diffs] = project.repo.diff(younger.id, older.id) rescue [] result[:commit] = Commit.new(older) end -- cgit v1.2.1 From 6d93eafa6a0db951afb15f584856a0b18a9ce03b Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Thu, 20 Dec 2012 13:50:43 +0100 Subject: disabled sorting of commits before compare --- app/models/commit.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index aa91bd546bd..ee16bf084de 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -87,14 +87,10 @@ class Commit last = project.commit(from.try(:strip)) if first && last - commits = [first, last].sort_by(&:created_at) - younger = commits.first - older = commits.last - - result[:same] = (younger.id == older.id) - result[:commits] = project.repo.commits_between(older.id, younger.id).map {|c| Commit.new(c)} - result[:diffs] = project.repo.diff(younger.id, older.id) rescue [] - result[:commit] = Commit.new(older) + result[:same] = (first.id == last.id) + result[:commits] = project.repo.commits_between(last.id, first.id).map {|c| Commit.new(c)} + result[:diffs] = project.repo.diff(last.id, first.id) rescue [] + result[:commit] = Commit.new(first) end result -- cgit v1.2.1 From 5d1044c335b033714744f286105d24980fb57f04 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Sat, 22 Dec 2012 20:36:33 +0100 Subject: Fix Commit#to_diff --- app/models/commit.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index ee16bf084de..f11b7fe0202 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -159,6 +159,8 @@ class Commit while !lines.first.start_with?("diff --git") do lines.shift end + lines.pop if lines.last =~ /^[\d.]+$/ # Git version + lines.pop if lines.last == "-- " # end of diff lines.join("\n") end end -- cgit v1.2.1