aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/commitgraph/v2/chunk.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-10-13 23:06:19 +0100
committerGitHub <noreply@github.com>2023-10-13 23:06:19 +0100
commit72ce9961c676b73c9bdd0678b64af7b0a42253f8 (patch)
tree3e6c8e7b0706918455a2d85fe6629242acab163f /plumbing/format/commitgraph/v2/chunk.go
parent24261e8288b2483628d69c751dd310ac79c38b2e (diff)
parent69b88d9bda44ebfe1d56a7624b956d9e20818c0e (diff)
downloadgo-git-5.10.0.tar.gz
Merge pull request #869 from zeripath/graph-generation-2v5.10.0
plumbing: commitgraph, Add generation v2 support
Diffstat (limited to 'plumbing/format/commitgraph/v2/chunk.go')
-rw-r--r--plumbing/format/commitgraph/v2/chunk.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/plumbing/format/commitgraph/v2/chunk.go b/plumbing/format/commitgraph/v2/chunk.go
index ab24320..11f4d31 100644
--- a/plumbing/format/commitgraph/v2/chunk.go
+++ b/plumbing/format/commitgraph/v2/chunk.go
@@ -3,7 +3,7 @@ package v2
import "bytes"
const (
- chunkSigLen = 4 // Length of a chunk signature
+ szChunkSig = 4 // Length of a chunk signature
chunkSigOffset = 4 // Offset of each chunk signature in chunkSignatures
)
@@ -28,14 +28,15 @@ const (
BaseGraphsListChunk // "BASE"
ZeroChunk // "\000\000\000\000"
)
+const lenChunks = int(ZeroChunk) // ZeroChunk is not a valid chunk type, but it is used to determine the length of the chunk type list.
// Signature returns the byte signature for the chunk type.
func (ct ChunkType) Signature() []byte {
if ct >= BaseGraphsListChunk || ct < 0 { // not a valid chunk type just return ZeroChunk
- return chunkSignatures[ZeroChunk*chunkSigOffset : ZeroChunk*chunkSigOffset+chunkSigLen]
+ return chunkSignatures[ZeroChunk*chunkSigOffset : ZeroChunk*chunkSigOffset+szChunkSig]
}
- return chunkSignatures[ct*chunkSigOffset : ct*chunkSigOffset+chunkSigLen]
+ return chunkSignatures[ct*chunkSigOffset : ct*chunkSigOffset+szChunkSig]
}
// ChunkTypeFromBytes returns the chunk type for the given byte signature.