aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/treenoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/object/treenoder.go')
-rw-r--r--plumbing/object/treenoder.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/plumbing/object/treenoder.go b/plumbing/object/treenoder.go
index 89fcdb1..80cd9b0 100644
--- a/plumbing/object/treenoder.go
+++ b/plumbing/object/treenoder.go
@@ -45,7 +45,17 @@ func (t *treeNoder) String() string {
return "treeNoder <" + t.name + ">"
}
+// The hash of a treeNoder is the result of concatenating the hash of
+// its contents and its mode; that way the difftree algorithm will
+// detect changes in the contents of files and also in their mode.
+//
+// Files with Regular and Deprecated file modes are considered the same
+// for the purpose of difftree, so Regular will be used as the mode for
+// Deprecated files here.
func (t *treeNoder) Hash() []byte {
+ if t.mode == filemode.Deprecated {
+ return append(t.hash[:], filemode.Regular.Bytes()...)
+ }
return append(t.hash[:], t.mode.Bytes()...)
}