Thread (93 messages) 93 messages, 2 authors, 2017-01-30

Re: [PATCH 25/27] attr: store attribute stacks in hashmap

flat view

From: Stefan Beller <hidden>
Date: 2017-01-18 21:21:48

On Wed, Jan 18, 2017 at 12:39 PM, Stefan Beller [off-list ref] wrote:
On Thu, Jan 12, 2017 at 3:53 PM, Brandon Williams [off-list ref] wrote:
quoted
-static void prepare_attr_stack(const char *path, int dirlen)
+/*
+ * This funciton should only be called from 'get_attr_stack()', which already
"function"
quoted
+               /* system-wide frame */
+               if (git_attr_system()) {
+                       e = read_attr_from_file(git_etc_gitattributes(), 1);
read_attr_from_file may return NULL, so we'd have to treat this similar
to below "root directory", i.e. xcalloc for an empty frame?
quoted
+
+               /* root directory */
+               if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
+                       e = read_attr(GITATTRIBUTES_FILE, 1);
+               } else {
+                       e = xcalloc(1, sizeof(struct attr_stack));
+               }
+               key = "";
+               push_stack(&core, e, key, strlen(key));
If this is a bare repo, could we just omit this frame instead of pushing
an empty xcalloc'd frame? (Same for the stack frames of system wide
and home dir) ?
The next patch moves this issue into the read_attr function.

So in the end we'd either need to fix read_attr_from_file to return
    res = xcalloc(1, sizeof(*res));
if (!fp), or we need to handle NULLs appropriately in 'core_attr_stack' ?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help