summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLars Schneider <larsxschneider@gmail.com>2016-01-29 08:21:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-01-29 19:04:27 (GMT)
commit1a8630dc3b1cc6f1361a4e5d94630133c24c97d9 (patch)
tree20f6d464fc2c5dc3144f95ceab54684377bd5469 /t
parent1b0b6dd0720572dcf90c264aeb91f96a017b0f25 (diff)
downloadgit-1a8630dc3b1cc6f1361a4e5d94630133c24c97d9.zip
git-1a8630dc3b1cc6f1361a4e5d94630133c24c97d9.tar.gz
git-1a8630dc3b1cc6f1361a4e5d94630133c24c97d9.tar.bz2
convert: treat an empty string for clean/smudge filters as "cat"
Once a lower-priority configuration file defines a clean or smudge filter, there is no convenient way to override it to produce as-is output. Even though the configuration mechanism implements "the last one wins" semantics, you cannot set them to an empty string and expect them to work, as apply_filter() would try to run the empty string as an external command and fail. The conversion is not done, but the function would still report a failure to convert. Even though resetting the variable to "cat" (i.e. pass the data back as-is and report success) is an obvious and a viable way to solve this, it is wasteful to spawn an external process just as a workaround. Instead, teach apply_filter() to treat an empty string as a no-op filter that always returns successfully its input as-is without conversion. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t0021-conversion.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 718efa0..7bac2bc 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -252,4 +252,20 @@ test_expect_success "filter: smudge empty file" '
test_cmp expected filtered-empty-in-repo
'
+test_expect_success 'disable filter with empty override' '
+ test_config_global filter.disable.smudge false &&
+ test_config_global filter.disable.clean false &&
+ test_config filter.disable.smudge false &&
+ test_config filter.disable.clean false &&
+
+ echo "*.disable filter=disable" >.gitattributes &&
+
+ echo test >test.disable &&
+ git -c filter.disable.clean= add test.disable 2>err &&
+ test_must_be_empty err &&
+ rm -f test.disable &&
+ git -c filter.disable.smudge= checkout -- test.disable 2>err &&
+ test_must_be_empty err
+'
+
test_done