File bnc1246578-clear-data.patch of Package libgit2.42574
Cherry-picked from eb84531575d8
Index: libgit2-1.7.2/src/libgit2/transports/smart_protocol.c
===================================================================
--- libgit2-1.7.2.orig/src/libgit2/transports/smart_protocol.c
+++ libgit2-1.7.2/src/libgit2/transports/smart_protocol.c
@@ -426,6 +426,7 @@ int git_smart__negotiate_fetch(
if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
goto on_error;
+ git_str_clear(&data);
while ((error = recv_pkt((git_pkt **)&pkt, NULL, t)) == 0) {
bool complete = false;
Index: libgit2-1.7.2/tests/libgit2/online/clone.c
===================================================================
--- libgit2-1.7.2.orig/tests/libgit2/online/clone.c
+++ libgit2-1.7.2/tests/libgit2/online/clone.c
@@ -649,6 +649,24 @@ void test_online_clone__ssh_github(void)
cl_git_pass(git_clone(&g_repo, SSH_REPO_URL, "./foo", &g_options));
}
+void test_online_clone__ssh_github_shallow(void)
+{
+#if !defined(GIT_SSH) || !defined(GIT_SSH_MEMORY_CREDENTIALS)
+ clar__skip();
+#endif
+
+ if (!_github_ssh_pubkey || !_github_ssh_privkey)
+ clar__skip();
+
+ cl_fake_homedir(NULL);
+
+ g_options.fetch_opts.callbacks.credentials = github_credentials;
+ g_options.fetch_opts.callbacks.certificate_check = succeed_certificate_check;
+ g_options.fetch_opts.depth = 1;
+
+ cl_git_pass(git_clone(&g_repo, SSH_REPO_URL, "./foo", &g_options));
+}
+
void test_online_clone__ssh_auth_methods(void)
{
int with_user;