From: Junio C Hamano Date: Mon, 21 Dec 2015 18:59:07 +0000 (-0800) Subject: Merge branch 'bc/format-patch-null-from-line' X-Git-Tag: v2.7.0-rc2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fbe959dde7eafcdae859e21cd734c07c7890c0a4?ds=inline;hp=-c Merge branch 'bc/format-patch-null-from-line' "format-patch" has learned a new option to zero-out the commit object name on the mbox "From " line. * bc/format-patch-null-from-line: format-patch: check that header line has expected format format-patch: add an option to suppress commit hash sha1_file.c: introduce a null_oid constant --- fbe959dde7eafcdae859e21cd734c07c7890c0a4 diff --combined cache.h index 5ab6cb50a6,071eecee7a..c63fcc113a --- a/cache.h +++ b/cache.h @@@ -11,29 -11,11 +11,29 @@@ #include "string-list.h" #include SHA1_HEADER -#ifndef git_SHA_CTX -#define git_SHA_CTX SHA_CTX -#define git_SHA1_Init SHA1_Init -#define git_SHA1_Update SHA1_Update -#define git_SHA1_Final SHA1_Final +#ifndef platform_SHA_CTX +/* + * platform's underlying implementation of SHA-1; could be OpenSSL, + * blk_SHA, Apple CommonCrypto, etc... Note that including + * SHA1_HEADER may have already defined platform_SHA_CTX for our + * own implementations like block-sha1 and ppc-sha1, so we list + * the default for OpenSSL compatible SHA-1 implementations here. + */ +#define platform_SHA_CTX SHA_CTX +#define platform_SHA1_Init SHA1_Init +#define platform_SHA1_Update SHA1_Update +#define platform_SHA1_Final SHA1_Final +#endif + +#define git_SHA_CTX platform_SHA_CTX +#define git_SHA1_Init platform_SHA1_Init +#define git_SHA1_Update platform_SHA1_Update +#define git_SHA1_Final platform_SHA1_Final + +#ifdef SHA1_MAX_BLOCK_SIZE +#include "compat/sha1-chunked.h" +#undef git_SHA1_Update +#define git_SHA1_Update git_SHA1_Update_Chunked #endif #include @@@ -831,6 -813,7 +831,7 @@@ extern const char *find_unique_abbrev(c extern int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len); extern const unsigned char null_sha1[GIT_SHA1_RAWSZ]; + extern const struct object_id null_oid; static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) { @@@ -1771,12 -1754,4 +1772,12 @@@ void stat_validity_update(struct stat_v int versioncmp(const char *s1, const char *s2); void sleep_millisec(int millisec); +/* + * Create a directory and (if share is nonzero) adjust its permissions + * according to the shared_repository setting. Only use this for + * directories under $GIT_DIR. Don't use it for working tree + * directories. + */ +void safe_create_dir(const char *dir, int share); + #endif /* CACHE_H */ diff --combined sha1_file.c index 2c68766ebf,a54deb0558..73ccd49a46 --- a/sha1_file.c +++ b/sha1_file.c @@@ -36,6 -36,7 +36,7 @@@ static inline uintmax_t sz_fmt(size_t s) { return s; } const unsigned char null_sha1[20]; + const struct object_id null_oid; /* * This is meant to hold a *small* number of objects that you would @@@ -3504,12 -3505,12 +3505,12 @@@ static int for_each_file_in_obj_subdir( break; } } - strbuf_setlen(path, baselen); + closedir(dir); + strbuf_setlen(path, baselen); if (!r && subdir_cb) r = subdir_cb(subdir_nr, path->buf, data); - closedir(dir); return r; }