aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/index/index.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-11-19 23:23:42 +0100
committerGitHub <noreply@github.com>2018-11-19 23:23:42 +0100
commitf62cd8e3495579a8323455fa0c4e6c44bb0d5e09 (patch)
tree22c4649f1e93076d96a263cdd876cb8a7e16694c /plumbing/format/index/index.go
parent2431109797aa48f33c0be2066c58f0cad0578ecc (diff)
parentb99653a9d3d231a9e1e4a1ddca41a08b3b733ae9 (diff)
downloadgo-git-f62cd8e3495579a8323455fa0c4e6c44bb0d5e09.tar.gz
Merge pull request #1025 from mcuadros/eoiev4.8.0
plumbing: format/index: support for EOIE extension
Diffstat (limited to 'plumbing/format/index/index.go')
-rw-r--r--plumbing/format/index/index.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/plumbing/format/index/index.go b/plumbing/format/index/index.go
index fc7b8cd..6c4b7ca 100644
--- a/plumbing/format/index/index.go
+++ b/plumbing/format/index/index.go
@@ -18,9 +18,10 @@ var (
// ErrEntryNotFound is returned by Index.Entry, if an entry is not found.
ErrEntryNotFound = errors.New("entry not found")
- indexSignature = []byte{'D', 'I', 'R', 'C'}
- treeExtSignature = []byte{'T', 'R', 'E', 'E'}
- resolveUndoExtSignature = []byte{'R', 'E', 'U', 'C'}
+ indexSignature = []byte{'D', 'I', 'R', 'C'}
+ treeExtSignature = []byte{'T', 'R', 'E', 'E'}
+ resolveUndoExtSignature = []byte{'R', 'E', 'U', 'C'}
+ endOfIndexEntryExtSignature = []byte{'E', 'O', 'I', 'E'}
)
// Stage during merge
@@ -50,6 +51,8 @@ type Index struct {
Cache *Tree
// ResolveUndo represents the 'Resolve undo' extension
ResolveUndo *ResolveUndo
+ // EndOfIndexEntry represents the 'End of Index Entry' extension
+ EndOfIndexEntry *EndOfIndexEntry
}
// Add creates a new Entry and returns it. The caller should first check that
@@ -193,3 +196,18 @@ type ResolveUndoEntry struct {
Path string
Stages map[Stage]plumbing.Hash
}
+
+// EndOfIndexEntry is the End of Index Entry (EOIE) is used to locate the end of
+// the variable length index entries and the begining of the extensions. Code
+// can take advantage of this to quickly locate the index extensions without
+// having to parse through all of the index entries.
+//
+// Because it must be able to be loaded before the variable length cache
+// entries and other index extensions, this extension must be written last.
+type EndOfIndexEntry struct {
+ // Offset to the end of the index entries
+ Offset uint32
+ // Hash is a SHA-1 over the extension types and their sizes (but not
+ // their contents).
+ Hash plumbing.Hash
+}