Class: GitDownloadStrategy
- Inherits:
-
VCSDownloadStrategy
- Object
- AbstractDownloadStrategy
- VCSDownloadStrategy
- GitDownloadStrategy
- Defined in:
- Library/Homebrew/download_strategy.rb
Overview
Strategy for downloading a Git repository.
Direct Known Subclasses
Constant Summary collapse
- SHALLOW_CLONE_ALLOWLIST =
[ %r{git://}, %r{https://github\.com}, %r{http://git\.sv\.gnu\.org}, %r{http://llvm\.org}, ].freeze
Constants inherited from VCSDownloadStrategy
VCSDownloadStrategy::REF_TYPES
Instance Attribute Summary
Attributes inherited from AbstractDownloadStrategy
#cache, #cached_location, #url
Instance Method Summary collapse
-
#initialize(url, name, version, **meta) ⇒ GitDownloadStrategy
constructor
A new instance of GitDownloadStrategy.
- #last_commit ⇒ Object
-
#source_modified_time ⇒ Object
Returns the most recent modified time for all files in the current working directory after stage.
Methods inherited from VCSDownloadStrategy
#commit_outdated?, #fetch, #fetch_last_commit, #head?
Methods inherited from AbstractDownloadStrategy
#basename, #clear_cache, #fetch, #quiet?, #shutup!, #stage
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(url, name, version, **meta) ⇒ GitDownloadStrategy
Returns a new instance of GitDownloadStrategy.
697 698 699 700 701 702 |
# File 'Library/Homebrew/download_strategy.rb', line 697 def initialize(url, name, version, **) super @ref_type ||= :branch @ref ||= "master" @shallow = .fetch(:shallow, true) end |
Instance Method Details
#last_commit ⇒ Object
711 712 713 714 |
# File 'Library/Homebrew/download_strategy.rb', line 711 def last_commit out, = silent_command("git", args: ["--git-dir", git_dir, "rev-parse", "--short=7", "HEAD"]) out.chomp end |
#source_modified_time ⇒ Object
Returns the most recent modified time for all files in the current working directory after stage.
705 706 707 708 |
# File 'Library/Homebrew/download_strategy.rb', line 705 def source_modified_time out, = silent_command("git", args: ["--git-dir", git_dir, "show", "-s", "--format=%cD"]) Time.parse(out) end |