aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/index/node.go
diff options
context:
space:
mode:
authorJohn Cai <johncai86@gmail.com>2021-11-04 15:02:00 -0400
committerJohn Cai <jcai@gitlab.com>2021-11-09 08:45:09 -0500
commitf92011d95f98f5deea4959c7d432704a4300d3a8 (patch)
tree6929972e94cc168ca210532954b234b55bb24165 /utils/merkletrie/index/node.go
parente4fcd078d42e945581616855ab78d8b7ed12df6c (diff)
downloadgo-git-f92011d95f98f5deea4959c7d432704a4300d3a8.tar.gz
simplified sparse checkout
This is the initial logic to support a simple sparse checkout where directories to be included can be specified in CheckoutOptions. This change doesn't fully support the sparse patterns, nor does this change include the optimization to collapse flie entries in ithe index that are excluded via the sparse checkout directory patterns included under the parent directory.
Diffstat (limited to 'utils/merkletrie/index/node.go')
-rw-r--r--utils/merkletrie/index/node.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/merkletrie/index/node.go b/utils/merkletrie/index/node.go
index d05b0c6..c1809f7 100644
--- a/utils/merkletrie/index/node.go
+++ b/utils/merkletrie/index/node.go
@@ -19,6 +19,7 @@ type node struct {
entry *index.Entry
children []noder.Noder
isDir bool
+ skip bool
}
// NewRootNode returns the root node of a computed tree from a index.Index,
@@ -39,7 +40,7 @@ func NewRootNode(idx *index.Index) noder.Noder {
continue
}
- n := &node{path: fullpath}
+ n := &node{path: fullpath, skip: e.SkipWorktree}
if fullpath == e.Name {
n.entry = e
} else {
@@ -58,6 +59,10 @@ func (n *node) String() string {
return n.path
}
+func (n *node) Skip() bool {
+ return n.skip
+}
+
// Hash the hash of a filesystem is a 24-byte slice, is the result of
// concatenating the computed plumbing.Hash of the file as a Blob and its
// plumbing.FileMode; that way the difftree algorithm will detect changes in the