summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-16 19:41:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-16 19:41:49 (GMT)
commitc0599f6993413360d8e35679a6b421d4eb16a698 (patch)
tree3d24df21194b3b9ce8f9238a424415f5c9ef2cfe /cache.h
parenta2caeb2e26d57fdbbc35314d2f6ea2b872dbf54e (diff)
parent4f7cb99ada26be5d86402a6e060f3ee16a672f16 (diff)
downloadgit-c0599f6993413360d8e35679a6b421d4eb16a698.zip
git-c0599f6993413360d8e35679a6b421d4eb16a698.tar.gz
git-c0599f6993413360d8e35679a6b421d4eb16a698.tar.bz2
Merge branch 'jk/diff-no-rename-empty'
Forbids rename detection logic from matching two empty files as renames during merge-recursive to prevent 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);