diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-26 21:35:33 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-26 21:35:33 +0400 |
commit | 3f231e235fb4b9c4d937a50fa4fbf35f9ed10387 (patch) | |
tree | 6f064ed970aa6363222824e2899681c383544c2d /cache.h | |
parent | 10a20b43c3d03ea1fab9095f96eda66086d3dcd2 (diff) | |
parent | 4f7cb99ada26be5d86402a6e060f3ee16a672f16 (diff) |
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.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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); |