dir: update stale description of treat_directory()

The documentation comment for treat_directory() was originally written
in 095952 (Teach directory traversal about subprojects, 2007-04-11)
which was before the 'struct dir_struct' split its bitfield of named
options into a 'flags' enum in 7c4c97c0 (Turn the flags in struct
dir_struct into a single variable, 2009-02-16). When those flags
changed, the comment became stale, since members like
'show_other_directories' transitioned into flags like
DIR_SHOW_OTHER_DIRECTORIES.

Update the comments for treat_directory() to use these flag names rather
than the old member names.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee 2021-05-12 17:28:21 +00:00 коммит произвёл Junio C Hamano
Родитель dd55fc0df1
Коммит 4e689d8171
1 изменённых файлов: 6 добавлений и 7 удалений

13
dir.c
Просмотреть файл

@ -1740,13 +1740,13 @@ static enum exist_status directory_exists_in_index(struct index_state *istate,
* Case 3: if we didn't have it in the index previously, we * Case 3: if we didn't have it in the index previously, we
* have a few sub-cases: * have a few sub-cases:
* *
* (a) if "show_other_directories" is true, we show it as * (a) if DIR_SHOW_OTHER_DIRECTORIES flag is set, we show it as
* just a directory, unless "hide_empty_directories" is * just a directory, unless DIR_HIDE_EMPTY_DIRECTORIES is
* also true, in which case we need to check if it contains any * also true, in which case we need to check if it contains any
* untracked and / or ignored files. * untracked and / or ignored files.
* (b) if it looks like a git directory, and we don't have * (b) if it looks like a git directory and we don't have the
* 'no_gitlinks' set we treat it as a gitlink, and show it * DIR_NO_GITLINKS flag, then we treat it as a gitlink, and
* as a directory. * show it as a directory.
* (c) otherwise, we recurse into it. * (c) otherwise, we recurse into it.
*/ */
static enum path_treatment treat_directory(struct dir_struct *dir, static enum path_treatment treat_directory(struct dir_struct *dir,
@ -1834,7 +1834,6 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
return path_recurse; return path_recurse;
} }
/* This is the "show_other_directories" case */
assert(dir->flags & DIR_SHOW_OTHER_DIRECTORIES); assert(dir->flags & DIR_SHOW_OTHER_DIRECTORIES);
/* /*
@ -1849,7 +1848,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
/* Special cases for where this directory is excluded/ignored */ /* Special cases for where this directory is excluded/ignored */
if (excluded) { if (excluded) {
/* /*
* In the show_other_directories case, if we're not * If DIR_SHOW_OTHER_DIRECTORIES is set and we're not
* hiding empty directories, there is no need to * hiding empty directories, there is no need to
* recurse into an ignored directory. * recurse into an ignored directory.
*/ */