summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorİbrahim Serdar Açıkgöz <serdaracikgoz86@gmail.com>2018-12-28 17:31:23 +0300
committerİbrahim Serdar Açıkgöz <serdaracikgoz86@gmail.com>2018-12-28 17:31:23 +0300
commitda697f6a3d7a431e69c326effca9096b4232ec6e (patch)
treea7f6e14fd701ef131203fd809eded79ffdf7be0b
parentfixes a semantic error while loading repositories (#47) (diff)
downloadgitbatch-da697f6a3d7a431e69c326effca9096b4232ec6e.tar.gz
hotfix on stashed items vol.3
-rw-r--r--pkg/git/cmd-stash.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkg/git/cmd-stash.go b/pkg/git/cmd-stash.go
index 463bd35..d2708ec 100644
--- a/pkg/git/cmd-stash.go
+++ b/pkg/git/cmd-stash.go
@@ -38,7 +38,7 @@ func (e *RepoEntity) loadStashedItems() error {
stashIDRegexInt := regexp.MustCompile(`[\d]+`)
stashBranchRegex := regexp.MustCompile(`^(.*?): `)
stashMsgRegex := regexp.MustCompile(`WIP on \(?([^)]*)\)?`)
- stashHashRegex := regexp.MustCompile(`[\w]{7}`)
+ stashHashRegex := regexp.MustCompile(`[\w|\d]{7}\s`)
stashlist := strings.Split(output, "\n")
for _, stashitem := range stashlist {
@@ -64,11 +64,12 @@ func (e *RepoEntity) loadStashedItems() error {
// trim branch section
trimmed = stashBranchRegex.Split(trimmed, 2)[1]
- hash := stashHashRegex.FindString(trimmed)
+ hash := ""
var desc string
- if stashHashRegex.MatchString(hash) && len(stashHashRegex.Split(trimmed, 2)) >= 2 {
- desc = stashHashRegex.Split(trimmed, 2)[1][1:]
+ if stashHashRegex.MatchString(trimmed) {
+ hash = stashHashRegex.FindString(trimmed)[:7]
+ desc = stashHashRegex.Split(trimmed, 2)[1]
} else {
desc = trimmed
}