Skip to content

Commit e86e81c

Browse files
committed
oid: make empty tree id global
Move the empty tree ID into a global space so that it can be generally used.
1 parent e1415dc commit e86e81c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/oid.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#include <string.h>
1414
#include <limits.h>
1515

16+
const git_oid git_oid__empty_tree_sha1 =
17+
{{ 0x4b, 0x82, 0x5d, 0xc6, 0x42, 0xcb, 0x6e, 0xb9, 0xa0, 0x60,
18+
0xe5, 0x4b, 0xf8, 0xd6, 0x92, 0x88, 0xfb, 0xee, 0x49, 0x04 }};
19+
1620
static char to_hex[] = "0123456789abcdef";
1721

1822
static int oid_error_invalid(const char *msg)

src/oid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include "git2/oid.h"
1313

14+
extern const git_oid git_oid__empty_tree_sha1;
15+
1416
/**
1517
* Format a git_oid into a newly allocated c-string.
1618
*

0 commit comments

Comments
 (0)