Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-23 00:00:22 +0300
committerJunio C Hamano <gitster@pobox.com>2021-03-23 00:00:22 +0300
commit2435feaa207eb3256dda978654b2a4308cdbd446 (patch)
tree136a6179216f388ce66a9c85145c620a6bda0231
parent204333b015a663a339c855c72b86034203b66a6a (diff)
parent6fab35f748651c408cf300d871d24c920108d94f (diff)
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
-rw-r--r--convert.c1
-rwxr-xr-xt/t0021-conversion.sh24
2 files changed, 24 insertions, 1 deletions
diff --git a/convert.c b/convert.c
index 9ecc1c699c..2d3a5a713c 100644
--- a/convert.c
+++ b/convert.c
@@ -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);
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index a9e10a0c21..b5749f327d 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -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 &&