summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-26 22:31:14 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:59:45 +1100
commitbd2c1eef53fbc6d76a34c6cf5c340e7a2eb5851b (patch)
tree141564e41323efc1be4c0da7bbc4c0064eea4309 /pkg
parentd1395b15bb980778b6a77cbc9c3f14775247aa8f (diff)
remove redundant fetch of reflog
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/git.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index ba20e2316..95bd380bd 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -1124,17 +1124,10 @@ func (c *GitCommand) FetchRemote(remoteName string) error {
// GetNewReflogCommits only returns the new reflog commits since the given lastReflogCommit
// if none is passed (i.e. it's value is nil) then we get all the reflog commits
func (c *GitCommand) GetNewReflogCommits(lastReflogCommit *Commit) ([]*Commit, error) {
- output, err := c.OSCommand.RunCommandWithOutput("git reflog --abbrev=20 --date=iso")
- if err != nil {
- // assume error means we have no reflog
- return []*Commit{}, nil
- }
-
- lines := strings.Split(strings.TrimSpace(output), "\n")
- commits := make([]*Commit, 0, len(lines))
+ commits := make([]*Commit, 0)
re := regexp.MustCompile(`(\w+).*HEAD@\{([^\}]+)\}: (.*)`)
cmd := c.OSCommand.ExecutableFromString("git reflog --abbrev=20 --date=iso")
- err = RunLineOutputCmd(cmd, func(line string) (bool, error) {
+ err := RunLineOutputCmd(cmd, func(line string) (bool, error) {
match := re.FindStringSubmatch(line)
if len(match) <= 1 {
return false, nil