Skip to content

depth option does not seem to work with libssh2 #6889

@ehuss

Description

@ehuss

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://git@github.com/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions