Module: Mate::Git

Defined in:
lib/mate/git.rb

Class Method Summary collapse

Class Method Details

.excludesfile(working_dir) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mate/git.rb', line 4

def excludesfile(working_dir)
  excludesfile = IO.popen(%W[git -C #{working_dir} config --get core.excludesfile], &:read)

  if excludesfile.empty?
    xdg_config_home = ENV['XDG_CONFIG_HOME']

    xdg_config_home = '~/.config' if !xdg_config_home || xdg_config_home.empty?

    excludesfile = File.join(xdg_config_home, 'git/ignore')
  end

  expand_path excludesfile
end

.git_dir(working_dir) ⇒ Object



26
27
28
# File 'lib/mate/git.rb', line 26

def git_dir(working_dir)
  expand_path IO.popen(%W[git -C #{working_dir} rev-parse --absolute-git-dir], err: '/dev/null', &:read)
end

.global_tmignoreObject



18
19
20
# File 'lib/mate/git.rb', line 18

def global_tmignore
  expand_path '~/.tmignore'
end

.toplevel(working_dir) ⇒ Object



22
23
24
# File 'lib/mate/git.rb', line 22

def toplevel(working_dir)
  expand_path IO.popen(%W[git -C #{working_dir} rev-parse --show-toplevel], err: '/dev/null', &:read)
end