зеркало из https://github.com/microsoft/git.git
Merge branch 'jk/submodule-fsck-loose-fixup'
Finishing touches to a topic that already is in 'maint'. * jk/submodule-fsck-loose-fixup: fsck: avoid looking at NULL blob->object t7415: don't bother creating commit for symlink test
This commit is contained in:
Коммит
fb6ac9e79a
3
fsck.c
3
fsck.c
|
@ -1036,7 +1036,8 @@ int fsck_finish(struct fsck_options *options)
|
|||
|
||||
blob = lookup_blob(oid);
|
||||
if (!blob) {
|
||||
ret |= report(options, &blob->object,
|
||||
struct object *obj = lookup_unknown_object(oid->hash);
|
||||
ret |= report(options, obj,
|
||||
FSCK_MSG_GITMODULES_BLOB,
|
||||
"non-blob found at .gitmodules");
|
||||
continue;
|
||||
|
|
|
@ -135,13 +135,10 @@ test_expect_success 'fsck detects symlinked .gitmodules file' '
|
|||
tricky="[foo]bar=true" &&
|
||||
content=$(git hash-object -w ../.gitmodules) &&
|
||||
target=$(printf "$tricky" | git hash-object -w --stdin) &&
|
||||
tree=$(
|
||||
{
|
||||
printf "100644 blob $content\t$tricky\n" &&
|
||||
printf "120000 blob $target\t.gitmodules\n"
|
||||
} | git mktree
|
||||
) &&
|
||||
commit=$(git commit-tree $tree) &&
|
||||
{
|
||||
printf "100644 blob $content\t$tricky\n" &&
|
||||
printf "120000 blob $target\t.gitmodules\n"
|
||||
} | git mktree &&
|
||||
|
||||
# Check not only that we fail, but that it is due to the
|
||||
# symlink detector; this grep string comes from the config
|
||||
|
@ -151,4 +148,22 @@ test_expect_success 'fsck detects symlinked .gitmodules file' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success 'fsck detects non-blob .gitmodules' '
|
||||
git init non-blob &&
|
||||
(
|
||||
cd non-blob &&
|
||||
|
||||
# As above, make the funny tree directly to avoid index
|
||||
# restrictions.
|
||||
mkdir subdir &&
|
||||
cp ../.gitmodules subdir/file &&
|
||||
git add subdir/file &&
|
||||
git commit -m ok &&
|
||||
git ls-tree HEAD | sed s/subdir/.gitmodules/ | git mktree &&
|
||||
|
||||
test_must_fail git fsck 2>output &&
|
||||
grep gitmodulesBlob output
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче