10000 git_submodule_update should call git_clone__submodule instead of git_clone to omit the path check · Issue #5830 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

git_submodule_update should call git_clone__submodule instead of git_clone to omit the path check #5830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lrm29 opened this issue Mar 29, 2021 · 2 comments · Fixed by #6444

Comments

@lrm29
Copy link
Contributor
lrm29 commented Mar 29, 2021

Reproduction steps

  1. Create a repository that has a submodule called "mysubmodule".
  2. Change directory to a folder which has a subfolder called "mysubmodule".
  3. Clone the main repository and then call git_submodule_update on "mysubmodule".

Expected behavior

The submodule is initialised and cloned.

Actual behavior

Unable to clone the submodule with error:
Error code = -4, Error class = 3. "mysubmodule" exists and is not an empty directory.

The path check in git__clone checks the current directory, rather than the repository working directory. If omitting the path check is undesirable, perhaps there's another solution.

Version of libgit2 (release number or SHA1)

1.0.0

Operating system(s) tested

Windows

@mattnite
Copy link

Ran into this issue on v1.3.0 as well

@abizjak
Copy link
Contributor
abizjak commented Jan 5, 2023

We also ran into this issue via the cargo generate tool which uses libgit2 as its dependency.

As I see it in git_submodule_update the submodule is cloned only if it is uninitialized. As a result it seems safe to use git_clone__submodule instead of git_clone here

6B6F
if ((error = git_clone(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0