Module: Chronicler::Git

Extended by:
Git
Included in:
Git
Defined in:
lib/chronicler/git.rb

Instance Method Summary collapse

Instance Method Details

#branch(path = nil) ⇒ Object



15
16
17
# File 'lib/chronicler/git.rb', line 15

def branch(path = nil)
  git "rev-parse --abbrev-ref HEAD", path
end

#branches(path = nil) ⇒ Object



19
20
21
# File 'lib/chronicler/git.rb', line 19

def branches(path = nil)
  git("for-each-ref refs/heads/ --format='%(refname:short)'", path).split("\n")
end

#current(path = nil) ⇒ Object



5
6
7
8
9
# File 'lib/chronicler/git.rb', line 5

def current(path = nil)
  if git("rev-parse --is-inside-work-tree 2> /dev/null", path) == "true"
    File.basename git("rev-parse --show-toplevel", path)
  end
end

#head(path = nil) ⇒ Object



11
12
13
# File 'lib/chronicler/git.rb', line 11

def head(path = nil)
  git "rev-parse HEAD", path
end