Class: Bringit::RevList
- Inherits:
-
Object
- Object
- Bringit::RevList
- Defined in:
- lib/bringit/rev_list.rb
Constant Summary collapse
- ALLOWED_VARIABLES =
%w[GIT_OBJECT_DIRECTORY GIT_ALTERNATE_OBJECT_DIRECTORIES].freeze
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(oldrev, newrev, repository:, env: nil) ⇒ RevList
constructor
A new instance of RevList.
- #valid? ⇒ Boolean
Constructor Details
#initialize(oldrev, newrev, repository:, env: nil) ⇒ RevList
Returns a new instance of RevList.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bringit/rev_list.rb', line 7 def initialize(oldrev, newrev, repository:, env: nil) @repository = repository @env = env.presence || {} @args = ["git", "--git-dir=#{repository.path}", "rev-list", "--max-count=1", oldrev, "^#{newrev}"] end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
3 4 5 |
# File 'lib/bringit/rev_list.rb', line 3 def env @env end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
3 4 5 |
# File 'lib/bringit/rev_list.rb', line 3 def repository @repository end |
Instance Method Details
#execute ⇒ Object
18 19 20 |
# File 'lib/bringit/rev_list.rb', line 18 def execute Bringit::Popen.popen(@args, nil, parse_environment_variables) end |
#valid? ⇒ Boolean
22 23 24 25 26 |
# File 'lib/bringit/rev_list.rb', line 22 def valid? environment_variables.all? do |(name, value)| value.to_s.start_with?(repository.path) end end |