mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Add feature of display committed file list #383
This commit is contained in:
committed by
Jesse Duffield
parent
1b6e46973e
commit
06fe726ee7
13
pkg/commands/commit_file.go
Normal file
13
pkg/commands/commit_file.go
Normal file
@ -0,0 +1,13 @@
|
||||
package commands
|
||||
|
||||
// CommitFile : A git commit file
|
||||
type CommitFile struct {
|
||||
Sha string
|
||||
Name string
|
||||
DisplayString string
|
||||
}
|
||||
|
||||
// GetDisplayStrings is a function.
|
||||
func (f *CommitFile) GetDisplayStrings() []string {
|
||||
return []string{f.DisplayString}
|
||||
}
|
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user