Skip to content

Commit

Permalink
fix: ignore missing config keys when getting the current mob
Browse files Browse the repository at this point in the history
if we don't have the git-mob.co-author key then there is no mob

resolves #67 #68
  • Loading branch information
davidalpert committed Aug 16, 2022
1 parent d5ea122 commit 2f207e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@wip
@announce-gitmob-log
@announce-stdout @announce-stderr
#@announce-gitmob-log
#@announce-stdout @announce-stderr
Feature: 🐛 GetAllGlobal(git-mob.co-author): nonzero exit code: 1: (when soloing)

Background:
Expand Down
8 changes: 6 additions & 2 deletions internal/gitConfig/atoms.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ func GetGlobal(key string) string {
// GetAll gets all values for a multi-valued option key.
func GetAll(key string) ([]string, error) {
o, exitCode, err := shell.SilentRun("git", "config", "--get-all", key)
if err != nil {
if ExitCode(exitCode) == SectionOrKeyIsInvalid {
return make([]string, 0), nil
} else if err != nil {
return make([]string, 0), ExitCode(exitCode).Errorf(err)
}
return strings.Split(o, "\n"), nil
Expand All @@ -47,7 +49,9 @@ func GetAll(key string) ([]string, error) {
// GetAllGlobal gets all values for a multi-valued option key.
func GetAllGlobal(key string) ([]string, error) {
o, exitCode, err := shell.SilentRun("git", "config", "--global", "--get-all", key)
if err != nil {
if ExitCode(exitCode) == SectionOrKeyIsInvalid {
return make([]string, 0), nil
} else if err != nil {
return make([]string, 0), ExitCode(exitCode).Errorf(err)
}
return strings.Split(o, "\n"), nil
Expand Down

0 comments on commit 2f207e5

Please sign in to comment.