summaryrefslogtreecommitdiff
path: root/app/models/deployment.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-09-30 15:45:27 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-10-04 09:54:31 +0200
commit7d46bd6128309e6ef1f3f4785889f5a0fef4de8f (patch)
tree2f278e639671954edc943ad212e305a929485517 /app/models/deployment.rb
parent4be63f5b5bd9c0859f5ba2b91ecdbdcc57b69b98 (diff)
downloadgitlab-ce-7d46bd6128309e6ef1f3f4785889f5a0fef4de8f.tar.gz
Save a fetchable ref per deployement
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 07d7e19e70d..cde6598fc7b 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -11,7 +11,7 @@ class Deployment < ActiveRecord::Base
delegate :name, to: :environment, prefix: true
- after_save :keep_around_commit
+ after_save :create_ref
def commit
project.commit(sha)
@@ -30,7 +30,7 @@ class Deployment < ActiveRecord::Base
end
def keep_around_commit
- project.repository.keep_around(self.sha)
+ project.repository.fetch_ref(project.repository.path_to_repo, ref, ref_path)
end
def manual_actions
@@ -76,4 +76,10 @@ class Deployment < ActiveRecord::Base
where.not(id: self.id).
take
end
+
+ private
+
+ def ref_path
+ "#{environment.ref_path}#{id}"
+ end
end