Skip to content

Commit 14d9c57

Browse files
peffgitster
authored andcommitted
define empty tree sha1 as a macro
This can potentially be used in a few places, so let's make it available to all parts of the code. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2baf185 commit 14d9c57

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cache.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ static inline void hashclr(unsigned char *hash)
528528
}
529529
extern int is_empty_blob_sha1(const unsigned char *sha1);
530530

531+
#define EMPTY_TREE_SHA1_HEX \
532+
"4b825dc642cb6eb9a060e54bf8d69288fbee4904"
533+
#define EMPTY_TREE_SHA1_BIN \
534+
"\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60" \
535+
"\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04"
536+
531537
int git_mkstemp(char *path, size_t n, const char *template);
532538

533539
/*

sha1_file.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,9 +1996,7 @@ static struct cached_object {
19961996
static int cached_object_nr, cached_object_alloc;
19971997

19981998
static struct cached_object empty_tree = {
1999-
/* empty tree sha1: 4b825dc642cb6eb9a060e54bf8d69288fbee4904 */
2000-
"\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60"
2001-
"\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04",
1999+
EMPTY_TREE_SHA1_BIN,
20022000
OBJ_TREE,
20032001
"",
20042002
0

0 commit comments

Comments
 (0)