Class: LearnTest::Git::Wip::Reference
- Defined in:
- lib/learn_test/git/wip/reference.rb
Constant Summary collapse
- PREFIX =
'refs/wip/'
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(base:, name:) ⇒ Reference
constructor
A new instance of Reference.
Methods inherited from Branch
Constructor Details
#initialize(base:, name:) ⇒ Reference
Returns a new instance of Reference.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/learn_test/git/wip/reference.rb', line 13 def initialize(base:, name:) dir = File.join(base.repo.path, PREFIX) file = File.join(dir, name) sha = base.log(1)[0].sha FileUtils.mkdir_p(dir, { mode: 0755 }) unless Dir.exist?(dir) File.open(file, 'w+') { |f| f.puts sha } unless File.exist?(file) super(base: base, name: "#{PREFIX}#{name}") end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
9 10 11 |
# File 'lib/learn_test/git/wip/reference.rb', line 9 def parent @parent end |