aboutsummaryrefslogtreecommitdiffstats
path: root/chunk-format.h
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2022-05-20 19:17:41 -0400
committerJunio C Hamano <gitster@pobox.com>2022-05-26 15:48:26 -0700
commitd9fef9d90d27b6794350ec3bc622042b79397088 (patch)
tree9543ec7910dadddc189e91ef723c49c44590e901 /chunk-format.h
parent1c573cdd7219db5600fb2b5249f7c8835c8d416d (diff)
downloadgit-d9fef9d90d27b6794350ec3bc622042b79397088.tar.gz
chunk-format.h: extract oid_version()
There are three definitions of an identical function which converts `the_hash_algo` into either 1 (for SHA-1) or 2 (for SHA-256). There is a copy of this function for writing both the commit-graph and multi-pack-index file, and another inline definition used to write the .rev header. Consolidate these into a single definition in chunk-format.h. It's not clear that this is the best header to define this function in, but it should do for now. (Worth noting, the .rev caller expects a 4-byte unsigned, but the other two callers work with a single unsigned byte. The consolidated version uses the latter type, and lets the compiler widen it when required). Another caller will be added in a subsequent patch. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'chunk-format.h')
-rw-r--r--chunk-format.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/chunk-format.h b/chunk-format.h
index 9ccbe00377..7885aa0848 100644
--- a/chunk-format.h
+++ b/chunk-format.h
@@ -2,6 +2,7 @@
#define CHUNK_FORMAT_H
#include "git-compat-util.h"
+#include "hash.h"
struct hashfile;
struct chunkfile;
@@ -65,4 +66,6 @@ int read_chunk(struct chunkfile *cf,
chunk_read_fn fn,
void *data);
+uint8_t oid_version(const struct git_hash_algo *algop);
+
#endif