From 922f4ed5a42123af0e4b74030273429f9fbaa43a Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 15 Aug 2018 09:42:02 +1000 Subject: [PATCH 1/4] try rev-parse of git symbolic-ref returns nothing --- pkg/git/branch_list_builder.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/git/branch_list_builder.go b/pkg/git/branch_list_builder.go index 41e59c093..e4a8461b8 100644 --- a/pkg/git/branch_list_builder.go +++ b/pkg/git/branch_list_builder.go @@ -39,7 +39,10 @@ func (b *BranchListBuilder) obtainCurrentBranch() commands.Branch { // even though you're on 'master' branchName, err := b.GitCommand.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD") if err != nil { - panic(err.Error()) + branchName, err = b.GitCommand.OSCommand.RunCommandWithOutput("git rev-parse --short HEAD") + if err != nil { + panic(err.Error()) + } } return commands.Branch{Name: strings.TrimSpace(branchName), Recency: " *"} } From 0687c07f50d7af4dce51f76a8f1eb38eb7ee1d1a Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 15 Aug 2018 09:45:24 +1000 Subject: [PATCH 2/4] more robust reading of reflog to get branch name --- pkg/git/branch_list_builder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/git/branch_list_builder.go b/pkg/git/branch_list_builder.go index e4a8461b8..869e05c98 100644 --- a/pkg/git/branch_list_builder.go +++ b/pkg/git/branch_list_builder.go @@ -144,7 +144,7 @@ func branchInfoFromLine(line string) (string, string, string) { r := regexp.MustCompile("\\|.*\\s") line = r.ReplaceAllString(line, " ") words := strings.Split(line, " ") - return words[0], words[1], words[3] + return words[0], words[1], words[len(words)-1] } func abbreviatedTimeUnit(timeUnit string) string { From 7002ee5d9b9b60b07657f6a985db9747f3c38b75 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 15 Aug 2018 09:52:23 +1000 Subject: [PATCH 3/4] bump version to v0.1.60 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 21d9c94d5..1b884a278 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.1.59 \ No newline at end of file +v0.1.60 \ No newline at end of file From db140842f3c10921153b3e19e66dd72b39fa00f8 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 15 Aug 2018 09:56:15 +1000 Subject: [PATCH 4/4] bump version to v0.1.61 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1b884a278..e26c92f2c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.1.60 \ No newline at end of file +v0.1.61 \ No newline at end of file