2021-03-31 14:26:53 +02:00
|
|
|
package filetree
|
|
|
|
|
2022-07-31 11:10:16 +02:00
|
|
|
import "github.com/jesseduffield/lazygit/pkg/commands/models"
|
2021-03-31 14:26:53 +02:00
|
|
|
|
2022-07-31 11:10:16 +02:00
|
|
|
// CommitFileNode wraps a node and provides some commit-file-specific methods for it.
|
2021-03-31 14:26:53 +02:00
|
|
|
type CommitFileNode struct {
|
2022-07-31 11:10:16 +02:00
|
|
|
*Node[models.CommitFile]
|
2021-03-31 14:26:53 +02:00
|
|
|
}
|
|
|
|
|
2022-07-31 11:10:16 +02:00
|
|
|
func NewCommitFileNode(node *Node[models.CommitFile]) *CommitFileNode {
|
2021-04-03 04:43:43 +02:00
|
|
|
if node == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-07-31 11:10:16 +02:00
|
|
|
return &CommitFileNode{Node: node}
|
2021-03-31 14:26:53 +02:00
|
|
|
}
|
|
|
|
|
2022-07-31 11:10:16 +02:00
|
|
|
// returns the underlying node, without any commit-file-specific methods attached
|
|
|
|
func (self *CommitFileNode) Raw() *Node[models.CommitFile] {
|
2022-08-01 12:32:01 +02:00
|
|
|
if self == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-07-31 11:10:16 +02:00
|
|
|
return self.Node
|
2021-03-31 14:26:53 +02:00
|
|
|
}
|