X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=http-push.c;h=2cd068a6f1ef0199cc27a1564678c91b66237a9b;hb=1c7b76be7d620bbaf2e6b8417f04012326bbb9df;hp=42727c8a45c7b50e8e6b2b04a0799c9ba85a0114;hpb=8fe114a6e1d606eb806b3f87b17fc22f106af7b7;p=git.git diff --git a/http-push.c b/http-push.c index 42727c8a4..2cd068a6f 100644 --- a/http-push.c +++ b/http-push.c @@ -9,6 +9,7 @@ #include "revision.h" #include "exec_cmd.h" #include "remote.h" +#include "list-objects.h" #include @@ -782,7 +783,7 @@ static void finish_request(struct transfer_request *request) lst = &((*lst)->next); *lst = (*lst)->next; - if (!verify_pack(target, 0)) + if (!verify_pack(target)) install_packed_git(target); else remote->can_update_info_refs = 0; @@ -1349,6 +1350,24 @@ static int unlock_remote(struct remote_lock *lock) return rc; } +static void remove_locks(void) +{ + struct remote_lock *lock = remote->locks; + + fprintf(stderr, "Removing remote locks...\n"); + while (lock) { + unlock_remote(lock); + lock = lock->next; + } +} + +static void remove_locks_on_signal(int signo) +{ + remove_locks(); + signal(signo, SIG_DFL); + raise(signo); +} + static void remote_ls(const char *path, int flags, void (*userFunc)(struct remote_ls_ctx *ls), void *userData); @@ -1860,31 +1879,6 @@ static int ref_newer(const unsigned char *new_sha1, return found; } -static void mark_edge_parents_uninteresting(struct commit *commit) -{ - struct commit_list *parents; - - for (parents = commit->parents; parents; parents = parents->next) { - struct commit *parent = parents->item; - if (!(parent->object.flags & UNINTERESTING)) - continue; - mark_tree_uninteresting(parent->tree); - } -} - -static void mark_edges_uninteresting(struct commit_list *list) -{ - for ( ; list; list = list->next) { - struct commit *commit = list->item; - - if (commit->object.flags & UNINTERESTING) { - mark_tree_uninteresting(commit->tree); - continue; - } - mark_edge_parents_uninteresting(commit); - } -} - static void add_remote_info_ref(struct remote_ls_ctx *ls) { struct strbuf *buf = (struct strbuf *)ls->userData; @@ -2256,6 +2250,11 @@ int main(int argc, char **argv) goto cleanup; } + signal(SIGINT, remove_locks_on_signal); + signal(SIGHUP, remove_locks_on_signal); + signal(SIGQUIT, remove_locks_on_signal); + signal(SIGTERM, remove_locks_on_signal); + /* Check whether the remote has server info files */ remote->can_update_info_refs = 0; remote->has_info_refs = remote_exists("info/refs"); @@ -2385,6 +2384,7 @@ int main(int argc, char **argv) } init_revisions(&revs, setup_git_directory()); setup_revisions(commit_argc, commit_argv, &revs, NULL); + revs.edge_hint = 0; /* just in case */ free(new_sha1_hex); if (old_sha1_hex) { free(old_sha1_hex); @@ -2395,7 +2395,7 @@ int main(int argc, char **argv) pushing = 0; if (prepare_revision_walk(&revs)) die("revision walk setup failed"); - mark_edges_uninteresting(revs.commits); + mark_edges_uninteresting(revs.commits, &revs, NULL); objects_to_send = get_delta(&revs, ref_lock); finish_all_active_slots();