Junio C Hamano <gitster@xxxxxxxxx> writes: >> - if (!path_in_cone_mode_sparse_checkout(path, istate)) >> - return NULL; >> + pos = index_name_pos_sparse(istate, path, strlen(path)); >> + pos = - pos - 2; >> >> - buf = read_blob_data_from_index(istate, path, &size); >> - if (!buf) >> - return NULL; >> - if (size >= ATTR_MAX_FILE_SIZE) { >> - warning(_("ignoring overly large gitattributes blob '%s'"), path); >> - return NULL; >> - } >> + if (!path_in_cone_mode_sparse_checkout(path, istate) && 0 <= pos) { >> + if (!S_ISSPARSEDIR(istate->cache[pos]->ce_mode)) >> + return NULL; Another thing I forgot to ask. When we are asked to read ".gitattributes" at the top level, does this code work correctly? As ".gitattributes" is at the root level, it won't be hidden inside a sparsified directory in the index, and we do not have to search for its parent. I just wanted to see if the relative_path computation and other things we see below will safely be skipped in such a case. Thanks.