Skip to content

Commit

Permalink
Merge branch 'ls/clean-smudge-override-in-config'
Browse files Browse the repository at this point in the history
Clean/smudge filters defined in a configuration file of lower
precedence can now be overridden to be a pass-through no-op by
setting the variable to an empty string.

* ls/clean-smudge-override-in-config:
  convert: treat an empty string for clean/smudge filters as "cat"
  • Loading branch information
Junio C Hamano committed Feb 10, 2016
2 parents fbf4bdf + 1a8630d commit a3764e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static int apply_filter(const char *path, const char *src, size_t len, int fd,
struct async async;
struct filter_params params;

if (!cmd)
if (!cmd || !*cmd)
return 0;

if (!dst)
Expand Down
16 changes: 16 additions & 0 deletions t/t0021-conversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a3764e7

Please sign in to comment.