• Show log

    Commit

  • Hash : 43cbe6b7
    Author : Patrick Steinhardt
    Date : 2018-11-28T13:36:47

    config: fix adding files if their parent directory is a file
    
    When we try to add a configuration file with `git_config_add_file_ondisk`, we
    treat nonexisting files as empty. We do this by performing a stat call, ignoring
    ENOENT errors. This works just fine in case the file or any of its parents
    simply does not exist, but there is also the case where any of the parent
    directories is not a directory, but a file. So e.g. trying to add a
    configuration file "/dev/null/.gitconfig" will fail, as `errno` will be ENOTDIR
    instead of ENOENT.
    
    Catch ENOTDIR in addition to ENOENT to fix the issue. Add a test that verifies
    we are able to add configuration files with such an invalid path file just fine.