Class: Gitlab::Git::Branch
Constant Summary collapse
- STALE_BRANCH_THRESHOLD =
3.months
Constants included from EncodingHelper
EncodingHelper::BOM_UTF8, EncodingHelper::ENCODING_CONFIDENCE_THRESHOLD, EncodingHelper::ESCAPED_CHARS, EncodingHelper::UNICODE_REPLACEMENT_CHARACTER
Instance Attribute Summary
Attributes inherited from Ref
#dereferenced_target, #name, #target
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Ref
extract_branch_name, #initialize
Methods included from EncodingHelper
#binary_io, #detect_binary?, #detect_encoding, #detect_libgit2_binary?, #encode!, #encode_binary, #encode_utf8, #encode_utf8_no_detect, #encode_utf8_with_escaping!, #encode_utf8_with_replacement_character, #force_encode_utf8, #strip_bom, #unquote_path
Constructor Details
This class inherits a constructor from Gitlab::Git::Ref
Class Method Details
Instance Method Details
#active? ⇒ Boolean
16 17 18 |
# File 'lib/gitlab/git/branch.rb', line 16 def active? self.dereferenced_target.committed_date >= STALE_BRANCH_THRESHOLD.ago end |
#cache_key ⇒ Object
28 29 30 |
# File 'lib/gitlab/git/branch.rb', line 28 def cache_key "branch:" + Digest::SHA1.hexdigest([name, target, dereferenced_target&.sha].join(':')) end |
#stale? ⇒ Boolean
20 21 22 |
# File 'lib/gitlab/git/branch.rb', line 20 def stale? !active? end |
#state ⇒ Object
24 25 26 |
# File 'lib/gitlab/git/branch.rb', line 24 def state active? ? :active : :stale end |