• M
    safe_create_leading_directories(): split on first of multiple slashes · bf10cf70
    Michael Haggerty 提交于
    If the input path has multiple slashes between path components (e.g.,
    "foo//bar"), then the old code was breaking the path at the last
    slash, not the first one.  So in the above example, the second slash
    was overwritten with NUL, resulting in the parent directory being
    sought as "foo/".
    
    When stat() is called on "foo/", it fails with ENOTDIR if "foo" exists
    but is not a directory.  This caused the wrong path to be taken in the
    subsequent logic.
    
    So instead, split path components at the first intercomponent slash
    rather than the last one.
    Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    bf10cf70
sha1_file.c 80.5 KB