summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-03 20:30:55 -0400
committerDouwe Maan <douwe@selenight.nl>2016-07-03 23:02:50 -0400
commit342986ae8c3e7a50814c3a457501b7218f983ddc (patch)
treee87a7d0fa9b584c8e95a7357070c5e9b22ecc288
parentcade34ba415b5c6cf22ac0435d5d3af59dc9670b (diff)
downloadgitlab-ce-13524-keep-around-commits.tar.gz
Document Repository#keep_around13524-keep-around-commits
-rw-r--r--app/models/repository.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index e3ad33a896a..078ca8f4e13 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -207,6 +207,10 @@ class Repository
rugged.references.exist?(ref)
end
+ # Makes sure a commit is kept around when Git garbage collection runs.
+ # Git GC will delete commits from the repository that are no longer in any
+ # branches or tags, but we want to keep some of these commits around, for
+ # example if they have comments or CI builds.
def keep_around(sha)
return unless sha && commit(sha)
@@ -219,10 +223,6 @@ class Repository
ref_exists?(keep_around_ref_name(sha))
end
- def keep_around_ref_name(sha)
- "refs/keep-around/#{sha}"
- end
-
def tag_names
cache.fetch(:tag_names) { raw_repository.tag_names }
end
@@ -1038,4 +1038,8 @@ class Repository
def tags_sorted_by_committed_date
tags.sort_by { |tag| commit(tag.target).committed_date }
end
+
+ def keep_around_ref_name(sha)
+ "refs/keep-around/#{sha}"
+ end
end