summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 66a1fb3)
raw | patch | inline | side by side (parent: 66a1fb3)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Thu, 4 Aug 2011 04:36:19 +0000 (06:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Aug 2011 22:53:17 +0000 (15:53 -0700) |
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c | patch | blob | history |
index bfa1f43793c841d05980d13bb0e864cbcebadf67..7f0f390d524a2d03595b742e720bd9b794089ee4 100644 (file)
--- a/attr.c
+++ b/attr.c
}
}
-static void prepare_attr_stack(const char *path, int dirlen)
+static void prepare_attr_stack(const char *path)
{
struct attr_stack *elem, *info;
- int len;
+ int dirlen, len;
struct strbuf pathbuf;
+ const char *cp;
+
+ cp = strrchr(path, '/');
+ if (!cp)
+ dirlen = 0;
+ else
+ dirlen = cp - path;
strbuf_init(&pathbuf, dirlen+2+strlen(GITATTRIBUTES_FILE));
int git_checkattr(const char *path, int num, struct git_attr_check *check)
{
struct attr_stack *stk;
- const char *cp;
- int dirlen, pathlen, i, rem;
+ int pathlen, i, rem;
bootstrap_attr_stack();
for (i = 0; i < attr_nr; i++)
check_all_attr[i].value = ATTR__UNKNOWN;
pathlen = strlen(path);
- cp = strrchr(path, '/');
- if (!cp)
- dirlen = 0;
- else
- dirlen = cp - path;
- prepare_attr_stack(path, dirlen);
+ prepare_attr_stack(path);
rem = attr_nr;
for (stk = attr_stack; 0 < rem && stk; stk = stk->prev)
rem = fill(path, pathlen, stk, rem);