summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1afca44)
raw | patch | inline | side by side (parent: 1afca44)
author | Jeff King <peff@peff.net> | |
Tue, 10 Jan 2012 19:32:06 +0000 (14:32 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Jan 2012 19:55:27 +0000 (11:55 -0800) |
In prepare_attr_stack, we pop the old elements of the stack
(which were left from a previous lookup and may or may not
be useful to us). Our loop to do so checks that we never
reach the top of the stack. However, the code immediately
afterwards will segfault if we did actually reach the top of
the stack.
Fortunately, this is not an actual bug, since we will never
pop all of the stack elements (we will always keep the root
gitattributes, as well as the builtin ones). So the extra
check in the loop condition simply clutters the code and
makes the intent less clear. Let's get rid of it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
(which were left from a previous lookup and may or may not
be useful to us). Our loop to do so checks that we never
reach the top of the stack. However, the code immediately
afterwards will segfault if we did actually reach the top of
the stack.
Fortunately, this is not an actual bug, since we will never
pop all of the stack elements (we will always keep the root
gitattributes, as well as the builtin ones). So the extra
check in the loop condition simply clutters the code and
makes the intent less clear. Let's get rid of it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c | patch | blob | history |
index 924b4408d5d94cbbf4c44db1ad919e60e178cb60..ad7eb9cd31719a6ef1b3229c68dbf2441f23c9f9 100644 (file)
--- a/attr.c
+++ b/attr.c
* Pop the ones from directories that are not the prefix of
* the path we are checking.
*/
- while (attr_stack && attr_stack->origin) {
+ while (attr_stack->origin) {
int namelen = strlen(attr_stack->origin);
elem = attr_stack;