In commit 45f24e78 (git_repository_init: stop traversing at windows root, 2019-04-12), we have fixed `git_futils_mkdir` to correctly handle the case where we create a directory in Windows-style filesystem roots like "C:\repo". The problem here is an off-by-one: previously, to that commit, we've been checking wether the parent directory's length is equal to the root directory's length incremented by one. When we call the function with "/example", then the parent directory's length ("/") is 1, but the root directory offset is 0 as the path is directly rooted without a drive prefix. This resulted in `1 == 0 + 1`, which was true. With the change, we've stopped incrementing the root directory length, and thus now compare `1 <= 0`, which is false. The previous way of doing it was kind of finicky any non-obvious, which is also why the error was introduced. So instead of just re-adding the increment, let's explicitly add a condition that aborts finding the parent if the current parent path is "/". Making this change causes Azure Pipelines to fail the testcase repo::init::nonexistent_paths on Unix-based systems. This is because we have just fixed creating directories in the filesystem root, which previously didn't work. As Docker-based tests are running as root user, we are thus able to create the non-existing path and will now succeed to create the repository that was expected to actually fail. Let's split this up into three different tests: - A test to verify that we do not create repos in a non-existing parent directoy if the flag `GIT_REPOSITORY_INIT_MKPATH` is not set. - A test to verify that we fail if the root directory does not exist. As there is a common root directory on Unix-based systems that always exist, we can only test for this on Windows-based systems. - A test to verify that we fail if trying to create a repository in an unwriteable parent directory. We can only test this if not running tests as root user, as CAP_DAC_OVERRIDE will cause us to ignore permissions when creating files.
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| apply | Loading commit data... | |
| attr | Loading commit data... | |
| blame | Loading commit data... | |
| buf | Loading commit data... | |
| checkout | Loading commit data... | |
| cherrypick | Loading commit data... | |
| clar | Loading commit data... | |
| clone | Loading commit data... | |
| commit | Loading commit data... | |
| config | Loading commit data... | |
| core | Loading commit data... | |
| date | Loading commit data... | |
| delta | Loading commit data... | |
| describe | Loading commit data... | |
| diff | Loading commit data... | |
| fetchhead | Loading commit data... | |
| filter | Loading commit data... | |
| graph | Loading commit data... | |
| ignore | Loading commit data... | |
| index | Loading commit data... | |
| iterator | Loading commit data... | |
| mailmap | Loading commit data... | |
| merge | Loading commit data... | |
| message | Loading commit data... | |
| network | Loading commit data... | |
| notes | Loading commit data... | |
| object | Loading commit data... | |
| odb | Loading commit data... | |
| online | Loading commit data... | |
| pack | Loading commit data... | |
| patch | Loading commit data... | |
| path | Loading commit data... | |
| perf | Loading commit data... | |
| rebase | Loading commit data... | |
| refs | Loading commit data... | |
| remote | Loading commit data... | |
| repo | Loading commit data... | |
| reset | Loading commit data... | |
| resources | Loading commit data... | |
| revert | Loading commit data... | |
| revwalk | Loading commit data... | |
| stash | Loading commit data... | |
| status | Loading commit data... | |
| stream | Loading commit data... | |
| stress | Loading commit data... | |
| submodule | Loading commit data... | |
| threads | Loading commit data... | |
| trace | Loading commit data... | |
| transport | Loading commit data... | |
| transports/smart | Loading commit data... | |
| win32 | Loading commit data... | |
| worktree | Loading commit data... | |
| CMakeLists.txt | Loading commit data... | |
| README.md | Loading commit data... | |
| clar.c | Loading commit data... | |
| clar.h | Loading commit data... | |
| clar_libgit2.c | Loading commit data... | |
| clar_libgit2.h | Loading commit data... | |
| clar_libgit2_timer.c | Loading commit data... | |
| clar_libgit2_timer.h | Loading commit data... | |
| clar_libgit2_trace.c | Loading commit data... | |
| clar_libgit2_trace.h | Loading commit data... | |
| generate.py | Loading commit data... | |
| main.c | Loading commit data... | |
| precompiled.c | Loading commit data... | |
| precompiled.h | Loading commit data... | |
| valgrind-supp-mac.txt | Loading commit data... |