Open
Description
git_clone fails with "repository path is not owned by user" when the repository I am cloning (foo
in the example below) is not owned by my user. However a git clone
on the command-line works.
$ git clone foo bar
Cloning into 'bar'...
done.
If I understand correctly, cloning a repository does not require reading its config. I think it's better to not validate ownership when a repository is opened but rather when the repository's config is actually read.
Reproduction steps
Compile and run the following code.
#include <stdio.h>
#include <git2.h>
int main()
{
git_libgit2_init();
git_repository *repo = NULL;
const char *url = "foo";
const char *path = "bar";
int error = git_clone(&repo, url, path, NULL);
if (error < 0) {
const git_error *e = git_error_last();
printf("Error %d/%d: %s\n", error, e->klass, e->message);
exit(error);
}
git_libgit2_shutdown();
}
Expected behavior
clone succeeds.
Actual behavior
clone fails with the following error message.
Error -36/7: repository path '/tmp/libgit2-bug/foo/' is not owned by current user
Version of libgit2 (release number or SHA1)
libgit2 version 1.6.3
git version 2.39.1
Operating system(s) tested
GNU Guix