Merge branch 'bc/sha-256-part-1-of-4'

SHA-256 transition continues.

* bc/sha-256-part-1-of-4: (22 commits)
  fast-import: add options for rewriting submodules
  fast-import: add a generic function to iterate over marks
  fast-import: make find_marks work on any mark set
  fast-import: add helper function for inserting mark object entries
  fast-import: permit reading multiple marks files
  commit: use expected signature header for SHA-256
  worktree: allow repository version 1
  init-db: move writing repo version into a function
  builtin/init-db: add environment variable for new repo hash
  builtin/init-db: allow specifying hash algorithm on command line
  setup: allow check_repository_format to read repository format
  t/helper: make repository tests hash independent
  t/helper: initialize repository if necessary
  t/helper/test-dump-split-index: initialize git repository
  t6300: make hash algorithm independent
  t6300: abstract away SHA-1-specific constants
  t: use hash-specific lookup tables to define test constants
  repository: require a build flag to use SHA-256
  hex: add functions to parse hex object IDs in any algorithm
  hex: introduce parsing variants taking hash algorithms
  ...
This commit is contained in:
Junio C Hamano
2020-03-26 17:11:20 -07:00
28 changed files with 624 additions and 142 deletions

View File

@ -456,7 +456,7 @@ const struct worktree *find_shared_symref(const char *symref,
int submodule_uses_worktrees(const char *path)
{
char *submodule_gitdir;
struct strbuf sb = STRBUF_INIT;
struct strbuf sb = STRBUF_INIT, err = STRBUF_INIT;
DIR *dir;
struct dirent *d;
int ret = 0;
@ -470,18 +470,16 @@ int submodule_uses_worktrees(const char *path)
get_common_dir_noenv(&sb, submodule_gitdir);
free(submodule_gitdir);
/*
* The check below is only known to be good for repository format
* version 0 at the time of writing this code.
*/
strbuf_addstr(&sb, "/config");
read_repository_format(&format, sb.buf);
if (format.version != 0) {
if (verify_repository_format(&format, &err)) {
strbuf_release(&err);
strbuf_release(&sb);
clear_repository_format(&format);
return 1;
}
clear_repository_format(&format);
strbuf_release(&err);
/* Replace config by worktrees. */
strbuf_setlen(&sb, sb.len - strlen("config"));