t7450: test .gitmodules symlink matching against obscured names
authorJeff King <peff@peff.net>
Mon, 3 May 2021 20:43:18 +0000 (16:43 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 4 May 2021 02:52:02 +0000 (11:52 +0900)
commit1cb12f3339086db5626a8003e3bd3398b968242a
tree0f2bd911dbb2f2ffe99b43d3df5b6be9f7c30bc3
parenta1ca398ba7da82622a9485400f88e62f3b756d1b
t7450: test .gitmodules symlink matching against obscured names

In t7450 we check that both verify_path() and fsck catch malformed
.gitmodules entries in trees. However, we don't check that we catch
filesystem-equivalent forms of these (e.g., ".GITMOD~1" on Windows).
Our name-matching functions are exercised well in t0060, but there's
nothing to test that we correctly call the matching functions from the
actual fsck and verify_path() code.

So instead of testing just .gitmodules, let's repeat our tests for a few
basic cases. We don't need to be exhaustive here (t0060 handles that),
but just make sure we hit one name of each type.

Besides pushing the tests into a function that takes the path as a
parameter, we'll need to do a few things:

  - adjust the directory name to accommodate the tests running multiple
    times

  - set core.protecthfs for index checks. Fsck always protects all types
    by default, but we want to be able to exercise the HFS routines on
    every system. Note that core.protectntfs is already the default
    these days, but it doesn't hurt to explicitly label our need for it.

  - we'll also take the filename ("gitmodules") as a parameter. All
    calls use the same name for now, but a future patch will extend this
    to handle other .gitfoo files. Note that our fake-content symlink
    destination is somewhat .gitmodules specific. But it isn't necessary
    for other files (which don't do a content check). And it happens to
    be a valid attribute and ignore file anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7450-bad-git-dotfiles.sh