diff options
author | Russell Belfer <rb@github.com> | 2013-09-12 14:47:15 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-09-17 09:31:45 -0700 |
commit | 0e32635fcf9a874fe66f871e88c0bbc0511544f1 (patch) | |
tree | facf17365a25e8eaaa5beb277c738051e02a7a32 | |
parent | a9f51e430fef49b3299ec33c11a4e6623e3f58cc (diff) | |
download | libgit2-0e32635fcf9a874fe66f871e88c0bbc0511544f1.tar.gz |
Move binary check to CRLF filter itself
Checkout should not reject binary files from filters, as a filter
may actually wish to operate on binary files. The CRLF filter should
reject binary files itself if it wishes to. Moreover, the CRLF
filter requires this logic so that users can emulate the checkout
data in their odb -> workdir filtering.
Conflicts:
src/checkout.c
src/crlf.c
-rw-r--r-- | src/checkout.c | 2 | ||||
-rw-r--r-- | src/crlf.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/checkout.c b/src/checkout.c index 140544c77..0e9d11bff 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -715,7 +715,7 @@ static int blob_content_to_file( git_buf out = GIT_BUF_INIT; git_filter_list *fl = NULL; - if (!opts->disable_filters && !git_blob_is_binary(blob)) + if (!opts->disable_filters) error = git_filter_list_load( &fl, git_blob_owner(blob), blob, path, GIT_FILTER_TO_WORKTREE); diff --git a/src/crlf.c b/src/crlf.c index bde85ca06..6b1fe46a3 100644 --- a/src/crlf.c +++ b/src/crlf.c @@ -209,6 +209,10 @@ static int crlf_apply_to_workdir( if (git_buf_len(from) == 0) return 0; + /* Don't filter binary files */ + if (git_buf_text_is_binary(from)) + return GIT_ENOTFOUND; + /* Determine proper line ending */ workdir_ending = line_ending(ca); if (!workdir_ending) |