Skip to content
Snippets Groups Projects
Commit fb6ac9e7 authored by Junio C Hamano's avatar Junio C Hamano
Browse files

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
parents b2453d34 47cc9131
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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;
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment