diff options
| -rw-r--r-- | examples/status.c | 5 | ||||
| -rw-r--r-- | src/clone.c | 6 | ||||
| -rw-r--r-- | src/transports/smart.c | 12 | ||||
| -rw-r--r-- | tests/odb/foreach.c | 2 |
4 files changed, 18 insertions, 7 deletions
diff --git a/examples/status.c b/examples/status.c index 9c99744cb..a59f34454 100644 --- a/examples/status.c +++ b/examples/status.c @@ -14,9 +14,10 @@ #include "common.h" #ifdef _WIN32 -#define sleep(a) Sleep(a * 1000) +# include <Windows.h> +# define sleep(a) Sleep(a * 1000) #else -#include <unistd.h> +# include <unistd.h> #endif /** diff --git a/src/clone.c b/src/clone.c index 24f1cae59..9ac9eb2a1 100644 --- a/src/clone.c +++ b/src/clone.c @@ -342,7 +342,7 @@ static bool should_checkout( int git_clone_into(git_repository *repo, git_remote *_remote, const git_checkout_options *co_opts, const char *branch, const git_signature *signature) { - int error = 0, old_fetchhead; + int error; git_buf reflog_message = GIT_BUF_INIT; git_remote *remote; const git_remote_callbacks *callbacks; @@ -359,13 +359,12 @@ int git_clone_into(git_repository *repo, git_remote *_remote, const git_checkout callbacks = git_remote_get_callbacks(_remote); if (!giterr__check_version(callbacks, 1, "git_remote_callbacks") && - (error = git_remote_set_callbacks(remote, git_remote_get_callbacks(_remote))) < 0) + (error = git_remote_set_callbacks(remote, callbacks)) < 0) goto cleanup; if ((error = git_remote_add_fetch(remote, "refs/tags/*:refs/tags/*")) < 0) goto cleanup; - old_fetchhead = git_remote_update_fetchhead(remote); git_remote_set_update_fetchhead(remote, 0); git_buf_printf(&reflog_message, "clone: from %s", git_remote_url(remote)); @@ -383,7 +382,6 @@ int git_clone_into(git_repository *repo, git_remote *_remote, const git_checkout error = git_checkout_head(repo, co_opts); cleanup: - git_remote_set_update_fetchhead(remote, old_fetchhead); git_remote_free(remote); git_buf_free(&reflog_message); diff --git a/src/transports/smart.c b/src/transports/smart.c index 69eaf9b78..7fb41f788 100644 --- a/src/transports/smart.c +++ b/src/transports/smart.c @@ -272,6 +272,18 @@ static int git_smart__close(git_transport *transport) unsigned int i; git_pkt *p; int ret; + git_smart_subtransport_stream *stream; + const char flush[] = "0000"; + + /* + * If we're still connected at this point and not using RPC, + * we should say goodbye by sending a flush, or git-daemon + * will complain that we disconnected unexpectedly. + */ + if (t->connected && !t->rpc && + !t->wrapped->action(&stream, t->wrapped, t->url, GIT_SERVICE_UPLOADPACK)) { + t->current_stream->write(t->current_stream, flush, 4); + } ret = git_smart__reset_stream(t, true); diff --git a/tests/odb/foreach.c b/tests/odb/foreach.c index ab3808b00..56daf7574 100644 --- a/tests/odb/foreach.c +++ b/tests/odb/foreach.c @@ -93,8 +93,8 @@ void test_odb_foreach__files_in_objects_dir(void) cl_git_pass(git_repository_open(&repo, "testrepo.git")); cl_git_pass(git_buf_printf(&buf, "%s/objects/somefile", git_repository_path(repo))); - cl_git_mkfile(buf.ptr, ""); + git_buf_free(&buf); cl_git_pass(git_repository_odb(&odb, repo)); cl_git_pass(git_odb_foreach(odb, foreach_cb, &nobj)); |
