diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-03-02 15:11:23 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-02 15:11:23 -0800 |
commit | d82b21b57a50f7820c57a13c09232077365095c7 (patch) | |
tree | 9de517b3e44fdbf24d0c01329d0ad3925ba34171 /http-push.c | |
parent | ca132089d2c7628fb6bca59715ece342777bdaf0 (diff) | |
parent | faa4bc35a05ddb1822f3770cd8c51859e3b929ee (diff) | |
download | git-d82b21b57a50f7820c57a13c09232077365095c7.tar.gz |
Merge branch 'cb/http-test'
* cb/http-test:
http-push: add regression tests
http-push: push <remote> :<branch> deletes remote branch
Diffstat (limited to 'http-push.c')
-rw-r--r-- | http-push.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/http-push.c b/http-push.c index 406270f6f4..5bc77361f9 100644 --- a/http-push.c +++ b/http-push.c @@ -2133,6 +2133,8 @@ static int delete_remote_branch(char *pattern, int force) /* Send delete request */ fprintf(stderr, "Removing remote branch '%s'\n", remote_ref->name); + if (dry_run) + return 0; url = xmalloc(strlen(remote->url) + strlen(remote_ref->name) + 1); sprintf(url, "%s%s", remote->url, remote_ref->name); slot = get_active_slot(); @@ -2306,6 +2308,16 @@ int main(int argc, char **argv) if (!ref->peer_ref) continue; + + if (is_zero_sha1(ref->peer_ref->new_sha1)) { + if (delete_remote_branch(ref->name, 1) == -1) { + error("Could not remove %s", ref->name); + rc = -4; + } + new_refs++; + continue; + } + if (!hashcmp(ref->old_sha1, ref->peer_ref->new_sha1)) { if (push_verbosely || 1) fprintf(stderr, "'%s': up-to-date\n", ref->name); @@ -2337,11 +2349,6 @@ int main(int argc, char **argv) } } hashcpy(ref->new_sha1, ref->peer_ref->new_sha1); - if (is_zero_sha1(ref->new_sha1)) { - error("cannot happen anymore"); - rc = -3; - continue; - } new_refs++; strcpy(old_hex, sha1_to_hex(ref->old_sha1)); new_hex = sha1_to_hex(ref->new_sha1); |