Replace copy SHA with copy subject on commit 'y s'

This commit is contained in:
Karim Khaleel 2024-01-01 16:52:40 +03:00
parent d97b37a178
commit 2c2436574d
4 changed files with 48 additions and 9 deletions

View file

@ -146,6 +146,15 @@ func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
return strings.TrimSpace(message), err
}
func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error) {
cmdArgs := NewGitCmd("log").
Arg("--format=%s", "--max-count=1", commitSha).
ToArgv()
subject, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
return strings.TrimSpace(subject), err
}
func (self *CommitCommands) GetCommitDiff(commitSha string) (string, error) {
cmdArgs := NewGitCmd("show").Arg("--no-color", commitSha).ToArgv()