Updated logic for new local branch

This commit is contained in:
Ryan McGuire 2023-12-11 11:50:11 -05:00
parent a37246872b
commit d4ad16fe16

View File

@ -83,7 +83,11 @@ func (p *Project) GetGitInfo() string {
head, _ := repo.Head()
branch := head.Name().String()[11:]
b, _ := repo.Branch(branch)
str = "\n" + pterm.LightCyan("Branch: ") + pterm.Bold.Sprint(b.Name) + "\n"
if b != nil {
str = "\n" + pterm.LightCyan("Branch: ") + pterm.Bold.Sprint(b.Name) + "\n"
} else {
str = "\n" + pterm.LightCyan("NEW Branch: ") + pterm.Bold.Sprint(branch) + "\n"
}
commit, _ := repo.CommitObject(head.Hash())
str += commit.String()