Merge branch 'bc/format-patch-null-from-line'
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Dec 2015 18:59:07 +0000 (10:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Dec 2015 18:59:08 +0000 (10:59 -0800)
"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

1  2 
cache.h
sha1_file.c
diff --combined cache.h
index 5ab6cb50a61e24dc418b351db8acc648b740c244,071eecee7ab01731ea7d33c1a59d8aa41c6e6489..c63fcc113a6e511a53f0170a07bd5dbbf12cc120
+++ b/cache.h
  #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 <zlib.h>
@@@ -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 2c68766ebf0cab5f13f684ac3e26061b93bda44a,a54deb0558f0809e0ee98d96c9b4e1797b698fd0..73ccd49a465b1cf8b668edf8c13ea75d6b8de718
@@@ -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;
  }