On 24 Jan 2016, at 16:06, Torsten Bögershausen <tboegi@xxxxxx> wrote: > On 24.01.16 13:22, larsxschneider@xxxxxxxxx wrote: >> From: Lars Schneider <larsxschneider@xxxxxxxxx> > Some minor nits inside: >> >> A clean/smudge filter can be disabled if set to an empty string. > "set to an empty string" refers to "git config" (in opposite to the > filter as such, which is specified in .gitattributes. > Does it make sense to write > "git config filter.XXX.smudge ''" or so ? I am not sure I get what you want here. Would this work for you? The clean/smudge filter commands (filter.XYZ.smudge and filter.XYZ.clean) can be disabled if set to an empty string. However, Git will still consider the empty string as command which results in a error message per processed file. > >> However, >> Git will try to run the empty string as command which results in a error >> message per processed file. >> >> Teach Git to consider an empty clean/smudge filter as legitimately disabled >> and do not print an error message. >> >> Signed-off-by: Lars Schneider <larsxschneider@xxxxxxxxx> >> --- >> convert.c | 4 ++-- >> t/t0021-conversion.sh | 14 ++++++++++++++ >> 2 files changed, 16 insertions(+), 2 deletions(-) >> >> diff --git a/convert.c b/convert.c >> index 814e814..58af965 100644 >> --- a/convert.c >> +++ b/convert.c >> @@ -786,7 +786,7 @@ int convert_to_git(const char *path, const char *src, size_t len, >> struct conv_attrs ca; >> >> convert_attrs(&ca, path); >> - if (ca.drv) { >> + if (ca.drv && ca.drv->clean && strlen(ca.drv->clean)) { >> filter = ca.drv->clean; >> required = ca.drv->required; >> } >> @@ -835,7 +835,7 @@ static int convert_to_working_tree_internal(const char *path, const char *src, >> struct conv_attrs ca; >> >> convert_attrs(&ca, path); >> - if (ca.drv) { >> + if (ca.drv && ca.drv->smudge && strlen(ca.drv->smudge)) { >> filter = ca.drv->smudge; >> required = ca.drv->required; >> } >> diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh >> index 718efa0..56e385c 100755 >> --- a/t/t0021-conversion.sh >> +++ b/t/t0021-conversion.sh >> @@ -252,4 +252,18 @@ test_expect_success "filter: smudge empty file" ' >> test_cmp expected filtered-empty-in-repo >> ' >> >> +test_expect_success 'disable filter with empty override' ' >> + git config filter.disable.smudge false && >> + git 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 -s err && > How about > test_cmp /dev/null err > to make debugging easier ? Right. Although I would probably go with Eric's suggestion and use "test_must_be_empty". That being said, I copied "! test -s" from the "filter large file" test in this file (added with 0b6806b). How does the list handle these cases? Should I add another commit to replace "! test -s" there, too? Thanks, Lars-- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html