Skip to content

Commit 1f68f3d

Browse files
bk2204gitster
authored andcommitted
hash: add a constant for the legacy hash algorithm
We have a a variety of uses of GIT_HASH_SHA1 littered throughout our code. Some of these really mean to represent specifically SHA-1, but some actually represent the original hash algorithm used in Git which is implied by older, legacy formats and protocols which do not contain hash information. For instance, the bundle v1 and v2 formats do not contain hash algorithm information, and thus SHA-1 is implied by the use of these formats. Add a constant for documentary purposes which indicates this value. It will always be the same as SHA-1, since this is an essential part of these formats, but its use indicates this particular reason and not any other reason why SHA-1 might be used. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ca6daa1 commit 1f68f3d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *s
176176
#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)
177177
/* Default hash algorithm if unspecified. */
178178
#define GIT_HASH_DEFAULT GIT_HASH_SHA1
179+
/* Legacy hash algorithm. Implied for older data formats which don't specify. */
180+
#define GIT_HASH_SHA1_LEGACY GIT_HASH_SHA1
179181

180182
/* "sha1", big-endian */
181183
#define GIT_SHA1_FORMAT_ID 0x73686131

0 commit comments

Comments
 (0)