File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -567,7 +567,9 @@ static void prepare_attr_stack(const char *path, int dirlen)
567567
568568 /*
569569 * Pop the ones from directories that are not the prefix of
570- * the path we are checking.
570+ * the path we are checking. Break out of the loop when we see
571+ * the root one (whose origin is an empty string "") or the builtin
572+ * one (whose origin is NULL) without popping it.
571573 */
572574 while (attr_stack -> origin ) {
573575 int namelen = strlen (attr_stack -> origin );
@@ -587,6 +589,13 @@ static void prepare_attr_stack(const char *path, int dirlen)
587589 * Read from parent directories and push them down
588590 */
589591 if (!is_bare_repository () || direction == GIT_ATTR_INDEX ) {
592+ /*
593+ * bootstrap_attr_stack() should have added, and the
594+ * above loop should have stopped before popping, the
595+ * root element whose attr_stack->origin is set to an
596+ * empty string.
597+ */
598+ assert (attr_stack -> origin );
590599 while (1 ) {
591600 char * cp ;
592601
You can’t perform that action at this time.
0 commit comments