-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
Reproduction steps
Attempt to create a repository on Windows with backslashes in the path with multiple intermediate directories.
git_repository *repo;
git_repository_init_options initopts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
git_libgit2_init();
initopts.flags |= GIT_REPOSITORY_INIT_MKDIR | GIT_REPOSITORY_INIT_MKPATH;
int error = git_repository_init_ext(&repo, "C:\\Temp\\foo\\bar", &initopts);
if (error) {
const git_error *err = git_error_last();
fprintf(stderr, "[%d] %s\n", err->klass, err->message);
}
The above should work if the backslashes are replaced with forward slashes.
Expected behavior
The path is created without error. According to the conventions doc: "If a function accepts a path on disk, then backslashes (0x5C) are also accepted on Windows."
Actual behavior
Fails to create intermediate directories if they contain backslashes.
Version of libgit2 (release number or SHA1)
Operating system(s) tested
Windows 10
Notes
I'm not exactly sure how slashes in paths are intended to be supported. I see a large number of places like mkdir_canonicalize
that only look for forward slashes.
Metadata
Metadata
Assignees
Labels
No labels