Skip to content

Commit

Permalink
fixup! Add virtual file system settings and hook proc
Browse files Browse the repository at this point in the history
This avoids crashes when not using the virtualfilesystem feature.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
derrickstolee authored and dscho committed Apr 12, 2024
1 parent 1b360c3 commit 6aabf8c
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1432,16 +1432,18 @@ enum pattern_match_result path_matches_pattern_list(
int result = NOT_MATCHED;
size_t slash_pos;

/*
* The virtual file system data is used to prevent git from traversing
* any part of the tree that is not in the virtual file system. Return
* 1 to exclude the entry if it is not found in the virtual file system,
* else fall through to the regular excludes logic as it may further exclude.
*/
if (*dtype == DT_UNKNOWN)
*dtype = resolve_dtype(DT_UNKNOWN, istate, pathname, pathlen);
if (is_excluded_from_virtualfilesystem(pathname, pathlen, *dtype) > 0)
return 1;
if (core_virtualfilesystem) {
/*
* The virtual file system data is used to prevent git from traversing
* any part of the tree that is not in the virtual file system. Return
* 1 to exclude the entry if it is not found in the virtual file system,
* else fall through to the regular excludes logic as it may further exclude.
*/
if (*dtype == DT_UNKNOWN)
*dtype = resolve_dtype(DT_UNKNOWN, istate, pathname, pathlen);
if (is_excluded_from_virtualfilesystem(pathname, pathlen, *dtype) > 0)
return 1;
}

if (!pl->use_cone_patterns) {
pattern = last_matching_pattern_from_list(pathname, pathlen, basename,
Expand Down Expand Up @@ -1796,16 +1798,18 @@ int is_excluded(struct dir_struct *dir, struct index_state *istate,
{
struct path_pattern *pattern;

/*
* The virtual file system data is used to prevent git from traversing
* any part of the tree that is not in the virtual file system. Return
* 1 to exclude the entry if it is not found in the virtual file system,
* else fall through to the regular excludes logic as it may further exclude.
*/
if (*dtype_p == DT_UNKNOWN)
*dtype_p = resolve_dtype(DT_UNKNOWN, istate, pathname, strlen(pathname));
if (is_excluded_from_virtualfilesystem(pathname, strlen(pathname), *dtype_p) > 0)
return 1;
if (core_virtualfilesystem) {
/*
* The virtual file system data is used to prevent git from traversing
* any part of the tree that is not in the virtual file system. Return
* 1 to exclude the entry if it is not found in the virtual file system,
* else fall through to the regular excludes logic as it may further exclude.
*/
if (*dtype_p == DT_UNKNOWN)
*dtype_p = resolve_dtype(DT_UNKNOWN, istate, pathname, strlen(pathname));
if (is_excluded_from_virtualfilesystem(pathname, strlen(pathname), *dtype_p) > 0)
return 1;
}

pattern = last_matching_pattern(dir, istate, pathname, dtype_p);
if (pattern)
Expand Down

0 comments on commit 6aabf8c

Please sign in to comment.