diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-04-26 10:01:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 10:01:34 +0200 |
commit | ca5d7bb1a790303d2ca245cb6225850bcf5d12a6 (patch) | |
tree | ef6abbccd43edd52ea51871da9127db87b566095 /plumbing/format/commitgraph/file.go | |
parent | 830ee5b7d6e7674d41d1fc5b47c2cd6e76a07f5b (diff) | |
parent | 2123c530503c3b70cc223f5efa77bce265133d26 (diff) | |
download | go-git-ca5d7bb1a790303d2ca245cb6225850bcf5d12a6.tar.gz |
Merge pull request #1134 from filipnavara/commitgraph-fmt-3
plumbing: format/commitgraph, rename structs/fields to follow the terms used by git more closely
Diffstat (limited to 'plumbing/format/commitgraph/file.go')
-rw-r--r-- | plumbing/format/commitgraph/file.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plumbing/format/commitgraph/file.go b/plumbing/format/commitgraph/file.go index dce6243..175d279 100644 --- a/plumbing/format/commitgraph/file.go +++ b/plumbing/format/commitgraph/file.go @@ -14,11 +14,11 @@ import ( var (
// ErrUnsupportedVersion is returned by OpenFileIndex when the commit graph
// file version is not supported.
- ErrUnsupportedVersion = errors.New("Unsuported version")
+ ErrUnsupportedVersion = errors.New("Unsupported version")
// ErrUnsupportedHash is returned by OpenFileIndex when the commit graph
// hash function is not supported. Currently only SHA-1 is defined and
// supported
- ErrUnsupportedHash = errors.New("Unsuported hash algorithm")
+ ErrUnsupportedHash = errors.New("Unsupported hash algorithm")
// ErrMalformedCommitGraphFile is returned by OpenFileIndex when the commit
// graph file is corrupted.
ErrMalformedCommitGraphFile = errors.New("Malformed commit graph file")
@@ -27,7 +27,7 @@ var ( oidFanoutSignature = []byte{'O', 'I', 'D', 'F'}
oidLookupSignature = []byte{'O', 'I', 'D', 'L'}
commitDataSignature = []byte{'C', 'D', 'A', 'T'}
- largeEdgeListSignature = []byte{'E', 'D', 'G', 'E'}
+ extraEdgeListSignature = []byte{'E', 'D', 'G', 'E'}
lastSignature = []byte{0, 0, 0, 0}
parentNone = uint32(0x70000000)
@@ -42,7 +42,7 @@ type fileIndex struct { oidFanoutOffset int64
oidLookupOffset int64
commitDataOffset int64
- largeEdgeListOffset int64
+ extraEdgeListOffset int64
}
// OpenFileIndex opens a serialized commit graph file in the format described at
@@ -106,8 +106,8 @@ func (fi *fileIndex) readChunkHeaders() error { fi.oidLookupOffset = int64(chunkOffset)
} else if bytes.Equal(chunkID, commitDataSignature) {
fi.commitDataOffset = int64(chunkOffset)
- } else if bytes.Equal(chunkID, largeEdgeListSignature) {
- fi.largeEdgeListOffset = int64(chunkOffset)
+ } else if bytes.Equal(chunkID, extraEdgeListSignature) {
+ fi.extraEdgeListOffset = int64(chunkOffset)
} else if bytes.Equal(chunkID, lastSignature) {
break
}
@@ -165,7 +165,7 @@ func (fi *fileIndex) GetIndexByHash(h plumbing.Hash) (int, error) { return 0, plumbing.ErrObjectNotFound
}
-func (fi *fileIndex) GetNodeByIndex(idx int) (*Node, error) {
+func (fi *fileIndex) GetCommitDataByIndex(idx int) (*CommitData, error) {
if idx >= fi.fanout[0xff] {
return nil, plumbing.ErrObjectNotFound
}
@@ -194,7 +194,7 @@ func (fi *fileIndex) GetNodeByIndex(idx int) (*Node, error) { if parent2&parentOctopusUsed == parentOctopusUsed {
// Octopus merge
parentIndexes = []int{int(parent1 & parentOctopusMask)}
- offset := fi.largeEdgeListOffset + 4*int64(parent2&parentOctopusMask)
+ offset := fi.extraEdgeListOffset + 4*int64(parent2&parentOctopusMask)
buf := make([]byte, 4)
for {
_, err := fi.reader.ReadAt(buf, offset)
@@ -220,7 +220,7 @@ func (fi *fileIndex) GetNodeByIndex(idx int) (*Node, error) { return nil, err
}
- return &Node{
+ return &CommitData{
TreeHash: treeHash,
ParentIndexes: parentIndexes,
ParentHashes: parentHashes,
|