Class: GitCoauthor::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/git_coauthor/git.rb

Class Method Summary collapse

Class Method Details

.amend_commit_message(message) ⇒ Object



12
13
14
15
# File 'lib/git_coauthor/git.rb', line 12

def self.amend_commit_message(message)
  `git commit --amend --only --no-verify --message "#{message}" 2> /dev/null`
  $CHILD_STATUS.success?
end

.commit_message(sha) ⇒ Object



7
8
9
10
# File 'lib/git_coauthor/git.rb', line 7

def self.commit_message(sha)
  message = `git log --format="%B" --max-count=1 #{sha} 2> /dev/null`
  [$CHILD_STATUS.success?, message]
end

.config_get(key) ⇒ Object



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

def self.config_get(key)
  value = `git config #{key} 2> /dev/null`.strip
  [$CHILD_STATUS.success?, value]
end

.config_set(key, value) ⇒ Object



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

def self.config_set(key, value)
  `git config #{key} #{value} 2> /dev/null`
  $CHILD_STATUS.success?
end

.config_unset(key) ⇒ Object



27
28
29
30
# File 'lib/git_coauthor/git.rb', line 27

def self.config_unset(key)
  `git config --unset #{key} 2> /dev/null`
  $CHILD_STATUS.success?
end