File: commit_file_node.go

package info (click to toggle)
lazygit 0.57.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,748 kB
  • sloc: sh: 153; makefile: 76
file content (25 lines) | stat: -rw-r--r-- 569 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package filetree

import "github.com/jesseduffield/lazygit/pkg/commands/models"

// CommitFileNode wraps a node and provides some commit-file-specific methods for it.
type CommitFileNode struct {
	*Node[models.CommitFile]
}

func NewCommitFileNode(node *Node[models.CommitFile]) *CommitFileNode {
	if node == nil {
		return nil
	}

	return &CommitFileNode{Node: node}
}

// returns the underlying node, without any commit-file-specific methods attached
func (self *CommitFileNode) Raw() *Node[models.CommitFile] {
	if self == nil {
		return nil
	}

	return self.Node
}