Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dir: fix treat_leading_path() to return false on non-directories #1723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 21, 2024

  1. dir: fix treat_leading_path() to return false on non-directories

    If treat_leading_path() encounters a non-directory in its loop over each
    leading path component, it should return false. This bug was introduced
    in commit b9670c1 ("dir: fix checks on common prefix directory",
    2019-12-19) where the check for `is_directory(sb.buf)` still breaks out
    of the loop but doesn't return false anymore. Instead, the loop is
    broken out and the last state result in the loop is used in the return
    conditional: `state == path_recurse`.
    
    This prevents the warning "warning: could not open directory" errors
    from occurring in `git status` or `git ls-files -o` calls on
    non-directory pathspecs. The warning was introduced in commit b673155
    ("dir.c: stop ignoring opendir() error in open_cached_dir()",
    2018-02-02).
    
    Signed-off-by: Ivan Tse <ivan.tse1@gmail.com>
    ivantsepp committed May 21, 2024
    Configuration menu
    Copy the full SHA
    06462bb View commit details
    Browse the repository at this point in the history