mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'mt/cleanly-die-upon-missing-required-filter'
We had a code to diagnose and die cleanly when a required clean/smudge filter is missing, but an assert before that unnecessarily fired, hiding the end-user facing die() message. * mt/cleanly-die-upon-missing-required-filter: convert: fail gracefully upon missing clean cmd on required filter
This commit is contained in:
@@ -1456,7 +1456,6 @@ void convert_to_git_filter_fd(const struct index_state *istate,
|
||||
convert_attrs(istate, &ca, path);
|
||||
|
||||
assert(ca.drv);
|
||||
assert(ca.drv->clean || ca.drv->process);
|
||||
|
||||
if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL, NULL))
|
||||
die(_("%s: clean filter '%s' failed"), path, ca.drv->name);
|
||||
|
||||
@@ -257,6 +257,30 @@ test_expect_success 'required filter clean failure' '
|
||||
test_must_fail git add test.fc
|
||||
'
|
||||
|
||||
test_expect_success 'required filter with absent clean field' '
|
||||
test_config filter.absentclean.smudge cat &&
|
||||
test_config filter.absentclean.required true &&
|
||||
|
||||
echo "*.ac filter=absentclean" >.gitattributes &&
|
||||
|
||||
echo test >test.ac &&
|
||||
test_must_fail git add test.ac 2>stderr &&
|
||||
test_i18ngrep "fatal: test.ac: clean filter .absentclean. failed" stderr
|
||||
'
|
||||
|
||||
test_expect_success 'required filter with absent smudge field' '
|
||||
test_config filter.absentsmudge.clean cat &&
|
||||
test_config filter.absentsmudge.required true &&
|
||||
|
||||
echo "*.as filter=absentsmudge" >.gitattributes &&
|
||||
|
||||
echo test >test.as &&
|
||||
git add test.as &&
|
||||
rm -f test.as &&
|
||||
test_must_fail git checkout -- test.as 2>stderr &&
|
||||
test_i18ngrep "fatal: test.as: smudge filter absentsmudge failed" stderr
|
||||
'
|
||||
|
||||
test_expect_success 'filtering large input to small output should use little memory' '
|
||||
test_config filter.devnull.clean "cat >/dev/null" &&
|
||||
test_config filter.devnull.required true &&
|
||||
|
||||
Reference in New Issue
Block a user