Skip to content

Commit

Permalink
Tolerate git config color settings
Browse files Browse the repository at this point in the history
The commit log and git branch parsing was not working when my commands
were getting colorized.  Explicitly pass --no-color to these two
commands to turn off colors.

commit-id:206a4539
  • Loading branch information
mstory21 authored and Eitan Joffe committed Mar 4, 2022
1 parent a8d0e08 commit 4ad55c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion github/githubclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func (c *client) ClosePullRequest(ctx context.Context, pr *github.PullRequest) {

func getLocalBranchName(gitcmd git.GitInterface) string {
var output string
err := gitcmd.Git("branch", &output)
err := gitcmd.Git("branch --no-color", &output)
check(err)
lines := strings.Split(output, "\n")
for _, line := range lines {
Expand Down
2 changes: 1 addition & 1 deletion spr/spr.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func (sd *stackediff) ProfilingSummary() {
// getLocalCommitStack returns a list of unmerged commits
func (sd *stackediff) getLocalCommitStack() []git.Commit {
var commitLog string
logCommand := fmt.Sprintf("log %s/%s..HEAD",
logCommand := fmt.Sprintf("log --no-color %s/%s..HEAD",
sd.config.Repo.GitHubRemote, sd.config.Repo.GitHubBranch)
sd.mustgit(logCommand, &commitLog)
commits, valid := sd.parseLocalCommitStack(commitLog)
Expand Down

0 comments on commit 4ad55c0

Please sign in to comment.