summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-12-07 14:48:53 +0100
committerDouwe Maan <douwe@gitlab.com>2015-12-07 14:48:53 +0100
commitd611a3879816d07f5842e2bdcea69b0813777107 (patch)
tree5f0df5c5d68731198b74b2df3d27070ef632d79c /app/models/commit.rb
parent0dcff1342b38c093a05c9edd13d422ee0b37b7bd (diff)
parente88fd58671f5407d80fafe1070d48b750b9f2e50 (diff)
downloadgitlab-ce-d611a3879816d07f5842e2bdcea69b0813777107.tar.gz
Merge branch 'master' into reference-pipeline-and-caching
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index a5f70b3a351..7f9a6707966 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -78,11 +78,23 @@ class Commit
}x
end
+ def self.link_reference_pattern
+ super("commit", /(?<commit>\h{6,40})/)
+ end
+
def to_reference(from_project = nil)
if cross_project_reference?(from_project)
- "#{project.to_reference}@#{id}"
+ project.to_reference + self.class.reference_prefix + self.id
+ else
+ self.id
+ end
+ end
+
+ def reference_link_text(from_project = nil)
+ if cross_project_reference?(from_project)
+ project.to_reference + self.class.reference_prefix + self.short_id
else
- id
+ self.short_id
end
end