diff options
| author | Philip Kelley <phkelley@hotmail.com> | 2013-01-11 17:16:55 -0800 |
|---|---|---|
| committer | Philip Kelley <phkelley@hotmail.com> | 2013-01-11 17:16:55 -0800 |
| commit | 359316b5d3bfca0ddfed2f653debe7b580b18727 (patch) | |
| tree | 7437ac8cbaac08be810c4b97f02a59451591475d /src | |
| parent | 160e4fb792b070e14c7094893e390c53d788648c (diff) | |
| parent | dd6367e37e7f9fec32bc3e8c99553ced825d47e9 (diff) | |
| download | libgit2-359316b5d3bfca0ddfed2f653debe7b580b18727.tar.gz | |
Merge pull request #1215 from phkelley/binaryunicode
Add a failing test for CRLF filters
Diffstat (limited to 'src')
| -rw-r--r-- | src/checkout.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/checkout.c b/src/checkout.c index cca66c34f..b58ef9f44 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -687,19 +687,23 @@ static int blob_content_to_file( git_buf unfiltered = GIT_BUF_INIT, filtered = GIT_BUF_INIT; git_vector filters = GIT_VECTOR_INIT; - if (opts->disable_filters || + /* Create a fake git_buf from the blob raw data... */ + filtered.ptr = blob->odb_object->raw.data; + filtered.size = blob->odb_object->raw.len; + /* ... and make sure it doesn't get unexpectedly freed */ + dont_free_filtered = true; + + if (!opts->disable_filters && + !git_buf_text_is_binary(&filtered) && (nb_filters = git_filters_load( &filters, git_object_owner((git_object *)blob), path, - GIT_FILTER_TO_WORKTREE)) == 0) { - - /* Create a fake git_buf from the blob raw data... */ - filtered.ptr = blob->odb_object->raw.data; - filtered.size = blob->odb_object->raw.len; - - /* ... and make sure it doesn't get unexpectedly freed */ - dont_free_filtered = true; + GIT_FILTER_TO_WORKTREE)) > 0) + { + /* reset 'filtered' so it can be a filter target */ + git_buf_init(&filtered, 0); + dont_free_filtered = false; } if (nb_filters < 0) |
