Merge pull request #172 from laijs/committer
Change commiter to committer
This commit is contained in:
commit
b1510a7872
|
@ -145,7 +145,7 @@ type CommitEntry struct {
|
||||||
Signer string
|
Signer string
|
||||||
SignerKey string `json:"signer_key"`
|
SignerKey string `json:"signer_key"`
|
||||||
Author PersonAction `json:"author,omitempty"`
|
Author PersonAction `json:"author,omitempty"`
|
||||||
Commiter PersonAction `json:"commiter,omitempty"`
|
Committer PersonAction `json:"committer,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersonAction is a time and identity of an action on a git commit
|
// PersonAction is a time and identity of an action on a git commit
|
||||||
|
@ -156,16 +156,16 @@ type PersonAction struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
prettyLogSubject = `--pretty=format:%s`
|
prettyLogSubject = `--pretty=format:%s`
|
||||||
prettyLogBody = `--pretty=format:%b`
|
prettyLogBody = `--pretty=format:%b`
|
||||||
prettyLogCommit = `--pretty=format:%H`
|
prettyLogCommit = `--pretty=format:%H`
|
||||||
prettyLogAuthorName = `--pretty=format:%aN`
|
prettyLogAuthorName = `--pretty=format:%aN`
|
||||||
prettyLogAuthorEmail = `--pretty=format:%aE`
|
prettyLogAuthorEmail = `--pretty=format:%aE`
|
||||||
prettyLogCommiterName = `--pretty=format:%cN`
|
prettyLogCommitterName = `--pretty=format:%cN`
|
||||||
prettyLogCommiterEmail = `--pretty=format:%cE`
|
prettyLogCommitterEmail = `--pretty=format:%cE`
|
||||||
prettyLogSigner = `--pretty=format:%GS`
|
prettyLogSigner = `--pretty=format:%GS`
|
||||||
prettyLogCommitNotes = `--pretty=format:%N`
|
prettyLogCommitNotes = `--pretty=format:%N`
|
||||||
prettyLogFormat = `--pretty=format:{"commit": "%H", "abbreviated_commit": "%h", "tree": "%T", "abbreviated_tree": "%t", "parent": "%P", "abbreviated_parent": "%p", "refs": "%D", "encoding": "%e", "sanitized_subject_line": "%f", "verification_flag": "%G?", "signer_key": "%GK", "author": { "date": "%aD" }, "commiter": { "date": "%cD" }}`
|
prettyLogFormat = `--pretty=format:{"commit": "%H", "abbreviated_commit": "%h", "tree": "%T", "abbreviated_tree": "%t", "parent": "%P", "abbreviated_parent": "%p", "refs": "%D", "encoding": "%e", "sanitized_subject_line": "%f", "verification_flag": "%G?", "signer_key": "%GK", "author": { "date": "%aD" }, "committer": { "date": "%cD" }}`
|
||||||
)
|
)
|
||||||
|
|
||||||
// GitLogCommit assembles the full information on a commit from its commit hash
|
// GitLogCommit assembles the full information on a commit from its commit hash
|
||||||
|
@ -210,17 +210,17 @@ func GitLogCommit(commit string) (*CommitEntry, error) {
|
||||||
}
|
}
|
||||||
c.Author.Email = strings.TrimSpace(string(output))
|
c.Author.Email = strings.TrimSpace(string(output))
|
||||||
|
|
||||||
output, err = exec.Command("git", "log", "-1", prettyLogCommiterName, commit).Output()
|
output, err = exec.Command("git", "log", "-1", prettyLogCommitterName, commit).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
c.Commiter.Name = strings.TrimSpace(string(output))
|
c.Committer.Name = strings.TrimSpace(string(output))
|
||||||
|
|
||||||
output, err = exec.Command("git", "log", "-1", prettyLogCommiterEmail, commit).Output()
|
output, err = exec.Command("git", "log", "-1", prettyLogCommitterEmail, commit).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
c.Commiter.Email = strings.TrimSpace(string(output))
|
c.Committer.Email = strings.TrimSpace(string(output))
|
||||||
|
|
||||||
output, err = exec.Command("git", "log", "-1", prettyLogCommitNotes, commit).Output()
|
output, err = exec.Command("git", "log", "-1", prettyLogCommitNotes, commit).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue