]> git.feebdaed.xyz Git - 0xmirror/git-lfs.git/commit
t/t-migrate-{fixup,info}.sh: enable macro tests
authorChris Darroch <chrisd8088@github.com>
Sun, 2 Nov 2025 20:40:16 +0000 (12:40 -0800)
committerChris Darroch <chrisd8088@github.com>
Sun, 2 Nov 2025 21:03:22 +0000 (13:03 -0800)
commite1e9a8eb8ef9a14e7a6144dd65b3ffc9af7b0bd4
tree2a0852db8df909f0327be73588a06bdb7b18dadc
parent951b1565a84c121764dc02ab0f8bd366cc992565
t/t-migrate-{fixup,info}.sh: enable macro tests

In PR #5382 we resolved the problem reported in #5332 where the
"git lfs migrate info --fixup" and "git lfs migrate import --fixup"
commands would panic when they encountered a .gitattributes file
with a non-pattern macro definition line.

However, at the time we did not update these commands to fully support
macro attributes, so that if a valid .gitattributes file existed in a
repository and defined a macro attribute for the "lfs" filter, and
assigned this macro attribute to a pattern which matched a file that
was not a proper Git LFS object, the two commands would ignore this and
not convert the object into a Git LFS object.

In commit 07b1adf4d059dc522c6413ff8af5133e2050f225 of PR #5382 we did,
though, add two tests to our t/t-migrate-info.sh and t/t-migrate-fixup.sh
test scripts which were designed to validate that the "git lfs migrate"
command, when used with its --fixup option, correctly and fully supported
the use of macro attributes.  We left these tests commented out, with the
expectation that we could enable them once we resolved the remaining
problems with the command's support for macro attributes.

In prior commits in this PR we have now refactored and improved the
processing of Git attributes by the "git lfs migrate" command and so
the problems described in commit 07b1adf4d059dc522c6413ff8af5133e2050f225
have been resolved.  We can therefore now enable the two tests that
commit introduced.

Note that we make two revisions to the "migrate import (--fixup,
.gitattributes with LFS macro)" test as it was originally written.
First, we fix a typo in name of the test, as it originally included
the subcommand name "info" instead of "import".

Second, we replace the final check in the test with two different checks.
In the original version, the final grep(2) command checked for the
presence of a non-macro Git LFS attribute definition; this was
inappropriately copied from the last check of the preceding "migrate
import (--fixup, .gitattributes with macro)" test.  Instead, we need to
check for two lines in the ".gitattributes" file, one of which defines
an "lfs" macro and the other of which applies that macro definition to
a specific file path pattern.
t/t-migrate-fixup.sh
t/t-migrate-info.sh