Re: [PATCH 1/5] attr.c: add push_stack() helper

2016-06-08 Thread Junio C Hamano
Stefan Beller writes: All of your questions is about !origin vs !*origin. This applies to the code in 'master', not specific to jc/attr topic's improvements. It is how the prepare_attr_stack() tells where the .gitattributes for the top-level directory is when popping the elements for other direc

Re: [PATCH 1/5] attr.c: add push_stack() helper

2016-06-08 Thread Stefan Beller
On Wed, Jun 8, 2016 at 3:58 PM, Junio C Hamano wrote: > +static void push_stack(struct attr_stack **attr_stack_p, > + struct attr_stack *elem, char *origin, size_t > originlen) > +{ > + if (elem) { > + elem->origin = origin; > + if (origin) >

[PATCH 1/5] attr.c: add push_stack() helper

2016-06-08 Thread Junio C Hamano
There are too many repetitious "I have this new attr_stack element; push it at the top of the stack" sequence. The new helper function push_stack() gives us a way to express what is going on at these places, and as a side effect, halves the number of times we mention the attr_stack global variable