summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-11-12 21:28:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-13 04:20:44 (GMT)
commit78a6766802ef32b82e6062e8e6ac5621894cc4a2 (patch)
treef482c347f6b747f214c43275822e4b08086772b2 /cache.h
parentf50e766b7b3dd02fc44ff7d4339c6f62e70fbf60 (diff)
downloadgit-78a6766802ef32b82e6062e8e6ac5621894cc4a2.zip
git-78a6766802ef32b82e6062e8e6ac5621894cc4a2.tar.gz
git-78a6766802ef32b82e6062e8e6ac5621894cc4a2.tar.bz2
Integrate hash algorithm support with repo setup
In future versions of Git, we plan to support an additional hash algorithm. Integrate the enumeration of hash algorithms with repository setup, and store a pointer to the enumerated data in struct repository. Of course, we currently only support SHA-1, so hard-code this value in read_repository_format. In the future, we'll enumerate this value from the configuration. Add a constant, the_hash_algo, which points to the hash_algo structure pointer in the repository global. Note that this is the hash which is used to serialize data to disk, not the hash which is used to display items to the user. The transition plan anticipates that these may be different. We can add an additional element in the future (say, ui_hash_algo) to provide for this case. Include repository.h in cache.h since we now need to have access to these struct and variable definitions. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index cb7fb7c..c238688 100644
--- a/cache.h
+++ b/cache.h
@@ -14,6 +14,7 @@
#include "hash.h"
#include "path.h"
#include "sha1-array.h"
+#include "repository.h"
#ifndef platform_SHA_CTX
/*
@@ -77,6 +78,8 @@ struct object_id {
unsigned char hash[GIT_MAX_RAWSZ];
};
+#define the_hash_algo the_repository->hash_algo
+
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
#define DTYPE(de) ((de)->d_type)
#else
@@ -888,6 +891,7 @@ struct repository_format {
int version;
int precious_objects;
int is_bare;
+ int hash_algo;
char *work_tree;
struct string_list unknown_extensions;
};