Skip to content

Commit

Permalink
Fixing boolean parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
whizzzkid committed Jul 7, 2022
1 parent 52458ca commit 6c44c6a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type TaskResult struct {
fixedOutput string
}

var shouldStage = (os.Getenv("COMMITTER_SKIP_STAGE") == "")
var shouldNotStage, _ = strconv.ParseBool(os.Getenv("COMMITTER_SKIP_STAGE"))
var autoFix, _ = strconv.ParseBool(os.Getenv("COMMITTER_AUTO_FIX"))

var changedFiles, _ = exec.Command("git", "diff", "--diff-filter=ACMRTUXB", "--cached", "--name-only").Output()
Expand Down Expand Up @@ -72,12 +72,12 @@ func (task Task) Execute(fix bool) TaskResult {

if fixedOutput != "" {
// If we have output, then we've corrected files
if shouldStage {
// Stage files by default automatically
task.stageRelevantFiles()
} else {
if shouldNotStage {
// Explicitly fail the pre-commit hook so the files can be staged manually
success = false
} else {
// Stage files by default automatically
task.stageRelevantFiles()
}
}
}
Expand Down

0 comments on commit 6c44c6a

Please sign in to comment.