From e2c1f793bfd6eb2e3b842a3cf182233435fcb487 Mon Sep 17 00:00:00 2001 From: Bryan Austin Date: Fri, 8 Jun 2018 14:44:45 -0700 Subject: [PATCH] Fix newline in git module repo names breaking display After setting up the git module with multiple repos and switching between them, I observed some graphical wonkiness in the display: https://i.imgur.com/R3e7eij.png After adding some log statements, I tracked it down to the `GitRepo.Repository` field having a newline in it after it's set from a command execution's stdout. This change strips the repository path of spaces when assigning to the `Repository` field, which fixes the display issues. --- git/git_repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/git_repo.go b/git/git_repo.go index 3f657732..5d3ba090 100644 --- a/git/git_repo.go +++ b/git/git_repo.go @@ -22,7 +22,7 @@ func NewGitRepo(repoPath string) *GitRepo { repo.Branch = repo.branch() repo.ChangedFiles = repo.changedFiles() repo.Commits = repo.commits() - repo.Repository = repo.repository() + repo.Repository = strings.TrimSpace(repo.repository()) return &repo }