diff options
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r-- | pkg/commands/git.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 43f78a28f..3e0bf2441 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -796,3 +796,15 @@ func (c *GitCommand) CherryPickCommits(commits []*Commit) error { return c.OSCommand.RunPreparedCommand(cmd) } + +// CommitFiles get the specified commit files +func (c *GitCommand) CommitFiles(commitID string) (string, error) { + cmd := fmt.Sprintf("git show --pretty= --name-only %s", commitID) + return c.OSCommand.RunCommandWithOutput(cmd) +} + +// ShowCommitFile get the diff of specified commit file +func (c *GitCommand) ShowCommitFile(commitID, file string) (string, error) { + cmd := fmt.Sprintf("git show --color %s -- %s", commitID, file) + return c.OSCommand.RunCommandWithOutput(cmd) +} |