summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-18 16:37:29 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-18 16:37:29 +0100
commitebfc7d052bbde2f0adcd986a207788d2aec7d85d (patch)
tree3718a061376df62a07834dab7990109435b78a38 /app/models/note.rb
parentdbd347bfa00e133da8ac178612ed8c30ef871ca4 (diff)
downloadgitlab-ce-ebfc7d052bbde2f0adcd986a207788d2aec7d85d.tar.gz
Fix condensed range in MR push comment.
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 9ca3e4d7e97..649e9b4e852 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -151,7 +151,7 @@ class Note < ActiveRecord::Base
)
end
- def create_new_commits_note(merge_request, project, author, new_commits, existing_commits = [])
+ def create_new_commits_note(merge_request, project, author, new_commits, existing_commits = [], oldrev = nil)
total_count = new_commits.length + existing_commits.length
commits_text = ActionController::Base.helpers.pluralize(total_count, 'commit')
body = "Added #{commits_text}:\n\n"
@@ -161,7 +161,11 @@ class Note < ActiveRecord::Base
if existing_commits.length == 1
existing_commits.first.short_id
else
- "#{existing_commits.first.short_id}..#{existing_commits.last.short_id}"
+ if oldrev
+ "#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}"
+ else
+ "#{existing_commits.first.short_id}..#{existing_commits.last.short_id}"
+ end
end
commits_text = ActionController::Base.helpers.pluralize(existing_commits.length, 'commit')