summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-26 17:35:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-26 17:35:33 (GMT)
commit3f231e235fb4b9c4d937a50fa4fbf35f9ed10387 (patch)
tree6f064ed970aa6363222824e2899681c383544c2d /cache.h
parent10a20b43c3d03ea1fab9095f96eda66086d3dcd2 (diff)
parent4f7cb99ada26be5d86402a6e060f3ee16a672f16 (diff)
downloadgit-3f231e235fb4b9c4d937a50fa4fbf35f9ed10387.zip
git-3f231e235fb4b9c4d937a50fa4fbf35f9ed10387.tar.gz
git-3f231e235fb4b9c4d937a50fa4fbf35f9ed10387.tar.bz2
Merge branch 'jk/diff-no-rename-empty' into maint
Rename detection logic used to match two empty files as renames during merge-recursive, leading unnatural mismerges. By Jeff King * jk/diff-no-rename-empty: merge-recursive: don't detect renames of empty files teach diffcore-rename to optionally ignore empty content make is_empty_blob_sha1 available everywhere drop casts from users EMPTY_TREE_SHA1_BIN
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index a8aceb5..806bf2b 100644
--- a/cache.h
+++ b/cache.h
@@ -708,6 +708,19 @@ static inline void hashclr(unsigned char *hash)
#define EMPTY_TREE_SHA1_BIN \
((const unsigned char *) EMPTY_TREE_SHA1_BIN_LITERAL)
+#define EMPTY_BLOB_SHA1_HEX \
+ "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
+#define EMPTY_BLOB_SHA1_BIN_LITERAL \
+ "\xe6\x9d\xe2\x9b\xb2\xd1\xd6\x43\x4b\x8b" \
+ "\x29\xae\x77\x5a\xd8\xc2\xe4\x8c\x53\x91"
+#define EMPTY_BLOB_SHA1_BIN \
+ ((const unsigned char *) EMPTY_BLOB_SHA1_BIN_LITERAL)
+
+static inline int is_empty_blob_sha1(const unsigned char *sha1)
+{
+ return !hashcmp(sha1, EMPTY_BLOB_SHA1_BIN);
+}
+
int git_mkstemp(char *path, size_t n, const char *template);
int git_mkstemps(char *path, size_t n, const char *template, int suffix_len);