Sha256: 2c91011bfb6c0c0c08caa47fc7605b86d91e747ba4acb0cfaaaa324f526817ee

Contents?: true

Size: 564 Bytes

Versions: 33

Compression:

Stored size: 564 Bytes

Contents

require 'git/path'

module Git

  class Worktree < Path

    attr_accessor :full, :dir, :gcommit

    def initialize(base, dir, gcommit = nil)
      @full = dir
      @full += ' ' + gcommit if !gcommit.nil?
      @base = base
      @dir = dir
      @gcommit = gcommit
    end

    def gcommit
      @gcommit ||= @base.gcommit(@full)
      @gcommit
    end

    def add
      @base.lib.worktree_add(@dir, @gcommit)
    end

    def remove
      @base.lib.worktree_remove(@dir)
    end

    def to_a
      [@full]
    end

    def to_s
      @full
    end
  end
end

Version data entries

33 entries across 33 versions & 3 rubygems

Version Path
git-2.3.2 lib/git/worktree.rb
git-2.3.1 lib/git/worktree.rb
git-2.3.0 lib/git/worktree.rb
git-2.2.0 lib/git/worktree.rb
git-2.1.1 lib/git/worktree.rb
git-2.1.0 lib/git/worktree.rb
git-2.0.0.pre3 lib/git/worktree.rb
git-2.0.0.pre2 lib/git/worktree.rb
git-2.0.0.pre1 lib/git/worktree.rb
git-1.19.1 lib/git/worktree.rb
git-1.19.0 lib/git/worktree.rb
git-1.18.0 lib/git/worktree.rb
git-1.17.2 lib/git/worktree.rb
git-1.17.1 lib/git/worktree.rb
git-1.17.0 lib/git/worktree.rb
git-1.16.0 lib/git/worktree.rb
git-1.15.0 lib/git/worktree.rb
git-1.14.0 lib/git/worktree.rb
git-1.13.2 lib/git/worktree.rb
git-1.13.1 lib/git/worktree.rb