File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -567,7 +567,9 @@ static void prepare_attr_stack(const char *path, int dirlen)
567
567
568
568
/*
569
569
* 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.
571
573
*/
572
574
while (attr_stack -> origin ) {
573
575
int namelen = strlen (attr_stack -> origin );
@@ -587,6 +589,13 @@ static void prepare_attr_stack(const char *path, int dirlen)
587
589
* Read from parent directories and push them down
588
590
*/
589
591
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 );
590
599
while (1 ) {
591
600
char * cp ;
592
601
You can’t perform that action at this time.
0 commit comments