diff options
author | Ryooooooga <eial5q265e5@gmail.com> | 2022-03-26 22:03:32 +0900 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-04-02 17:04:42 +1100 |
commit | 30be50b641dbe594d7968e79536028f22beee1b0 (patch) | |
tree | 3366984909742fd0cd1997f4a923910df266cd42 /pkg/commands/loaders/reflog_commits.go | |
parent | 99ecc1cfdff9a29a8cfa1bf21cb80c082bee212b (diff) |
add `Commit.ParentRefName()`
Diffstat (limited to 'pkg/commands/loaders/reflog_commits.go')
-rw-r--r-- | pkg/commands/loaders/reflog_commits.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg/commands/loaders/reflog_commits.go b/pkg/commands/loaders/reflog_commits.go index 56c1c71f9..56d10b9f3 100644 --- a/pkg/commands/loaders/reflog_commits.go +++ b/pkg/commands/loaders/reflog_commits.go @@ -32,21 +32,28 @@ func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit filterPathArg = fmt.Sprintf(" --follow -- %s", self.cmd.Quote(filterPath)) } - cmdObj := self.cmd.New(fmt.Sprintf(`git log -g --abbrev=40 --format="%s"%s`, "%h%x00%ct%x00%gs", filterPathArg)).DontLog() + cmdObj := self.cmd.New(fmt.Sprintf(`git log -g --abbrev=40 --format="%s"%s`, "%h%x00%ct%x00%gs%x00%p", filterPathArg)).DontLog() onlyObtainedNewReflogCommits := false err := cmdObj.RunAndProcessLines(func(line string) (bool, error) { - fields := strings.SplitN(line, "\x00", 3) - if len(fields) <= 2 { + fields := strings.SplitN(line, "\x00", 4) + if len(fields) <= 3 { return false, nil } unixTimestamp, _ := strconv.Atoi(fields[1]) + parentHashes := fields[3] + parents := []string{} + if len(parentHashes) > 0 { + parents = strings.Split(parentHashes, " ") + } + commit := &models.Commit{ Sha: fields[0], Name: fields[2], UnixTimestamp: int64(unixTimestamp), Status: "reflog", + Parents: parents, } // note that the unix timestamp here is the timestamp of the COMMIT, not the reflog entry itself, |