Skip to content
Snippets Groups Projects
Commit 16ecd7c6 authored by Douwe Maan's avatar Douwe Maan
Browse files

Document Repository#keep_around

parent 3286dd7a
No related branches found
No related tags found
1 merge request!5062Don't garbage collect commits that have related DB records like comments
Pipeline #
Loading
Loading
@@ -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)
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment