Skip to content

depth option does not seem to work with libssh2 #6889

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
ehuss opened this issue Sep 25, 2024 · 5 comments · Fixed by #6947
Closed

depth option does not seem to work with libssh2 #6889

ehuss opened this issue Sep 25, 2024 · 5 comments · Fixed by #6947

Comments

@ehuss
Copy link
Contributor

ehuss commented Sep 25, 2024

Setting the depth parameter doesn't seem to work when using the libssh2 backend.

Reproduction steps

Modify the clone example to set the depth parameter:

diff --git a/examples/clone.c b/examples/clone.c
index 22d9d9b61..d8873cef1 100644
--- a/examples/clone.c
+++ b/examples/clone.c
@@ -90,6 +90,7 @@ int lg2_clone(git_repository *repo, int argc, char **argv)
 	clone_opts.fetch_opts.callbacks.transfer_progress = &fetch_progress;
 	clone_opts.fetch_opts.callbacks.credentials = cred_acquire_cb;
 	clone_opts.fetch_opts.callbacks.payload = &pd;
+	clone_opts.fetch_opts.depth = 1;

 	/* Do the clone */
 	error = git_clone(&cloned_repo, url, path, &clone_opts);

Build with libssh2:

cmake -DUSE_SSH=libssh2 -DBUILD_EXAMPLES=on ..

Run the example trying to clone an ssh URL:

./examples/lg2 clone ssh://[email protected]/libgit2/libgit2.git asdf
SSH Key: /Users/eric/.ssh/id_ed25519
Password: ...

ERROR 12: could not read from remote repository
Bad news:
 could not read from remote repository

Note that it works with the exec backend.

Expected behavior

Should be able to set depth with SSH.

Actual behavior

Get GIT_EEOF GIT_ERROR_NET error.

Version of libgit2 (release number or SHA1)

9f34061

Operating system(s) tested

macOS

@HA55EHH
Copy link

HA55EHH commented Oct 4, 2024

Same error here.

@ethomson
Copy link
Member

Surprising. I haven't had time to take a look yet; does it work with any backend for you? 🤔

@ehuss
Copy link
Contributor Author

ehuss commented Oct 23, 2024

It works with the default (https) backend, and ssh with the "exec" option. I have not tried any others.

@ethomson
Copy link
Member

That's so weird. Thanks for the details.

@Bandeapart1964
Copy link

Bandeapart1964 commented Nov 23, 2024

same bug here, http clone with depth is fine, but ssh(libssh2 as backend) will got err: could not read from remote repository

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.

4 participants