Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
attr.c: clarify the logic to pop attr_stack
author
Junio C Hamano
<gitster@pobox.com>
Tue, 10 Jan 2012 20:28:38 +0000
(12:28 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 10 Jan 2012 20:28:38 +0000
(12:28 -0800)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
909ca7b
)
diff --git
a/attr.c
b/attr.c
index a6e6523d29dcf021c4866660183f8442f44b7ff6..2ce73651381c8ebfa6dfed6c2013b72059861b2b 100644
(file)
--- a/
attr.c
+++ b/
attr.c
@@
-567,7
+567,9
@@
static void prepare_attr_stack(const char *path, int dirlen)
/*
* Pop the ones from directories that are not the prefix of
/*
* Pop the ones from directories that are not the prefix of
- * the path we are checking.
+ * the path we are checking. Break out of the loop when we see
+ * the root one (whose origin is an empty string "") or the builtin
+ * one (whose origin is NULL) without popping it.
*/
while (attr_stack->origin) {
int namelen = strlen(attr_stack->origin);
*/
while (attr_stack->origin) {
int namelen = strlen(attr_stack->origin);
@@
-587,6
+589,13
@@
static void prepare_attr_stack(const char *path, int dirlen)
* Read from parent directories and push them down
*/
if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
* Read from parent directories and push them down
*/
if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
+ /*
+ * bootstrap_attr_stack() should have added, and the
+ * above loop should have stopped before popping, the
+ * root element whose attr_stack->origin is set to an
+ * empty string.
+ */
+ assert(attr_stack->origin);
while (1) {
char *cp;
while (1) {
char *cp;