summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-12 22:30:05 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-14 08:57:06 -0700
commit35ebfd6a0cd71795c4fa510b99e55ad89fb654f1 (patch)
treea9cc59a9fb5476b5fc80d1de577c6eb06b3c8ffe /attr.c
parentd0bfd026a8241d544c339944976927b388d61a5e (diff)
downloadgit-35ebfd6a0cd71795c4fa510b99e55ad89fb654f1.tar.gz
Define 'crlf' attribute.
This defines the semantics of 'crlf' attribute as an example. When a path has this attribute unset (i.e. '!crlf'), autocrlf line-end conversion is not applied. Eventually we would want to let users to build a pipeline of processing to munge blob data to filesystem format (and in the other direction) based on combination of attributes, and at that point the mechanism in convert_to_{git,working_tree}() that looks at 'crlf' attribute needs to be enhanced. Perhaps the existing 'crlf' would become the first step in the input chain, and the last step in the output chain. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/attr.c b/attr.c
index 7435d927a9..ed4db01a89 100644
--- a/attr.c
+++ b/attr.c
@@ -378,3 +378,21 @@ int git_checkattr(const char *path, int num, struct git_attr_check *check)
rem = fill(path, pathlen, stk, check, num, rem);
return 0;
}
+
+static void setup_binary_check(struct git_attr_check *check)
+{
+ static struct git_attr *attr_binary;
+
+ if (!attr_binary)
+ attr_binary = git_attr("binary", 6);
+ check->attr = attr_binary;
+}
+
+int git_path_is_binary(const char *path)
+{
+ struct git_attr_check attr_binary_check;
+
+ setup_binary_check(&attr_binary_check);
+ return (!git_checkattr(path, 1, &attr_binary_check) &&
+ (0 < attr_binary_check.isset));
+}