Merge branch 'sp/smart-http'
* sp/smart-http: (37 commits) http-backend: Let gcc check the format of more printf-type functions. http-backend: Fix access beyond end of string. http-backend: Fix bad treatment of uintmax_t in Content-Length t5551-http-fetch: Work around broken Accept header in libcurl t5551-http-fetch: Work around some libcurl versions http-backend: Protect GIT_PROJECT_ROOT from /../ requests Git-aware CGI to provide dumb HTTP transport http-backend: Test configuration options http-backend: Use http.getanyfile to disable dumb HTTP serving test smart http fetch and push http tests: use /dumb/ URL prefix set httpd port before sourcing lib-httpd t5540-http-push: remove redundant fetches Smart HTTP fetch: gzip requests Smart fetch over HTTP: client side Smart push over HTTP: client side Discover refs via smart HTTP server when available http-backend: more explict LocationMatch http-backend: add example for gitweb on same URL http-backend: use mod_alias instead of mod_rewrite ... Conflicts: .gitignore remote-curl.c
This commit is contained in:
31
http-push.c
31
http-push.c
@ -78,6 +78,7 @@ static int push_verbosely;
|
||||
static int push_all = MATCH_REFS_NONE;
|
||||
static int force_all;
|
||||
static int dry_run;
|
||||
static int helper_status;
|
||||
|
||||
static struct object_list *objects;
|
||||
|
||||
@ -604,7 +605,7 @@ static void finish_request(struct transfer_request *request)
|
||||
preq = (struct http_pack_request *)request->userData;
|
||||
|
||||
if (preq) {
|
||||
if (finish_http_pack_request(preq) > 0)
|
||||
if (finish_http_pack_request(preq) == 0)
|
||||
fail = 0;
|
||||
release_http_pack_request(preq);
|
||||
}
|
||||
@ -1811,6 +1812,10 @@ int main(int argc, char **argv)
|
||||
dry_run = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--helper-status")) {
|
||||
helper_status = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--verbose")) {
|
||||
push_verbosely = 1;
|
||||
http_is_verbose = 1;
|
||||
@ -1913,9 +1918,12 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Remove a remote branch if -d or -D was specified */
|
||||
if (delete_branch) {
|
||||
if (delete_remote_branch(refspec[0], force_delete) == -1)
|
||||
if (delete_remote_branch(refspec[0], force_delete) == -1) {
|
||||
fprintf(stderr, "Unable to delete remote branch %s\n",
|
||||
refspec[0]);
|
||||
if (helper_status)
|
||||
printf("error %s cannot remove\n", refspec[0]);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1927,6 +1935,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if (!remote_refs) {
|
||||
fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
|
||||
if (helper_status)
|
||||
printf("error null no match\n");
|
||||
rc = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -1944,8 +1954,12 @@ int main(int argc, char **argv)
|
||||
if (is_null_sha1(ref->peer_ref->new_sha1)) {
|
||||
if (delete_remote_branch(ref->name, 1) == -1) {
|
||||
error("Could not remove %s", ref->name);
|
||||
if (helper_status)
|
||||
printf("error %s cannot remove\n", ref->name);
|
||||
rc = -4;
|
||||
}
|
||||
else if (helper_status)
|
||||
printf("ok %s\n", ref->name);
|
||||
new_refs++;
|
||||
continue;
|
||||
}
|
||||
@ -1953,6 +1967,8 @@ int main(int argc, char **argv)
|
||||
if (!hashcmp(ref->old_sha1, ref->peer_ref->new_sha1)) {
|
||||
if (push_verbosely || 1)
|
||||
fprintf(stderr, "'%s': up-to-date\n", ref->name);
|
||||
if (helper_status)
|
||||
printf("ok %s up to date\n", ref->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1976,6 +1992,8 @@ int main(int argc, char **argv)
|
||||
"need to pull first?",
|
||||
ref->name,
|
||||
ref->peer_ref->name);
|
||||
if (helper_status)
|
||||
printf("error %s non-fast forward\n", ref->name);
|
||||
rc = -2;
|
||||
continue;
|
||||
}
|
||||
@ -1989,14 +2007,19 @@ int main(int argc, char **argv)
|
||||
if (strcmp(ref->name, ref->peer_ref->name))
|
||||
fprintf(stderr, " using '%s'", ref->peer_ref->name);
|
||||
fprintf(stderr, "\n from %s\n to %s\n", old_hex, new_hex);
|
||||
if (dry_run)
|
||||
if (dry_run) {
|
||||
if (helper_status)
|
||||
printf("ok %s\n", ref->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Lock remote branch ref */
|
||||
ref_lock = lock_remote(ref->name, LOCK_TIME);
|
||||
if (ref_lock == NULL) {
|
||||
fprintf(stderr, "Unable to lock remote branch %s\n",
|
||||
ref->name);
|
||||
if (helper_status)
|
||||
printf("error %s lock error\n", ref->name);
|
||||
rc = 1;
|
||||
continue;
|
||||
}
|
||||
@ -2047,6 +2070,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!rc)
|
||||
fprintf(stderr, " done\n");
|
||||
if (helper_status)
|
||||
printf("%s %s\n", !rc ? "ok" : "error", ref->name);
|
||||
unlock_remote(ref_lock);
|
||||
check_locks();
|
||||
}
|
||||
|
Reference in New Issue
Block a user