зеркало из https://github.com/microsoft/git.git
Merge branch 'jk/index-pack-maint'
"index-pack --strict" has been taught to make sure that it runs the final object integrity checks after making the freshly indexed packfile available to itself. * jk/index-pack-maint: index-pack: correct install_packed_git() args index-pack: handle --strict checks of non-repo packs prepare_commit_graft: treat non-repository as a noop
This commit is contained in:
Коммит
549ca8aa7c
|
@ -1482,8 +1482,12 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
|
||||||
} else
|
} else
|
||||||
chmod(final_index_name, 0444);
|
chmod(final_index_name, 0444);
|
||||||
|
|
||||||
if (do_fsck_object)
|
if (do_fsck_object) {
|
||||||
add_packed_git(final_index_name, strlen(final_index_name), 0);
|
struct packed_git *p;
|
||||||
|
p = add_packed_git(final_index_name, strlen(final_index_name), 0);
|
||||||
|
if (p)
|
||||||
|
install_packed_git(the_repository, p);
|
||||||
|
}
|
||||||
|
|
||||||
if (!from_stdin) {
|
if (!from_stdin) {
|
||||||
printf("%s\n", sha1_to_hex(hash));
|
printf("%s\n", sha1_to_hex(hash));
|
||||||
|
|
3
commit.c
3
commit.c
|
@ -207,6 +207,9 @@ static void prepare_commit_graft(void)
|
||||||
|
|
||||||
if (commit_graft_prepared)
|
if (commit_graft_prepared)
|
||||||
return;
|
return;
|
||||||
|
if (!startup_info->have_repository)
|
||||||
|
return;
|
||||||
|
|
||||||
graft_file = get_graft_file();
|
graft_file = get_graft_file();
|
||||||
read_graft_file(graft_file);
|
read_graft_file(graft_file);
|
||||||
/* make sure shallows are read */
|
/* make sure shallows are read */
|
||||||
|
|
|
@ -421,6 +421,12 @@ test_expect_success 'index-pack <pack> works in non-repo' '
|
||||||
test_path_is_file foo.idx
|
test_path_is_file foo.idx
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'index-pack --strict <pack> works in non-repo' '
|
||||||
|
rm -f foo.idx &&
|
||||||
|
nongit git index-pack --strict ../foo.pack &&
|
||||||
|
test_path_is_file foo.idx
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
|
test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
|
||||||
test_must_fail git index-pack --threads=2 2>err &&
|
test_must_fail git index-pack --threads=2 2>err &&
|
||||||
grep ^warning: err >warnings &&
|
grep ^warning: err >warnings &&
|
||||||
|
|
|
@ -122,6 +122,16 @@ test_expect_success 'transfer.fsckObjects handles odd pack (index)' '
|
||||||
test_must_fail git -C dst.git index-pack --strict --stdin <odd.pack
|
test_must_fail git -C dst.git index-pack --strict --stdin <odd.pack
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'index-pack --strict works for non-repo pack' '
|
||||||
|
rm -rf dst.git &&
|
||||||
|
git init --bare dst.git &&
|
||||||
|
cp odd.pack dst.git &&
|
||||||
|
test_must_fail git -C dst.git index-pack --strict odd.pack 2>output &&
|
||||||
|
# Make sure we fail due to bad gitmodules content, not because we
|
||||||
|
# could not read the blob in the first place.
|
||||||
|
grep gitmodulesName output
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'fsck detects symlinked .gitmodules file' '
|
test_expect_success 'fsck detects symlinked .gitmodules file' '
|
||||||
git init symlink &&
|
git init symlink &&
|
||||||
(
|
(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче