transport-helper: check for 'forced update' message

So the remote-helpers can tell us when a forced push was needed. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Nov 12, 2013 at 14:56 UTC f9e3c6bebb89de12f2dfdaa1899cb22e9ef32542
1 file changed +7 -1
transport-helper.c
+7 -1
@@ -643,7 +643,7 @@ static int push_update_ref_status(struct strbuf *buf,
643 struct ref *remote_refs)
644 {
645 char *refname, *msg;
646 - int status;
646 + int status, forced = 0;
647
648 if (!prefixcmp(buf->buf, "ok ")) {
649 status = REF_STATUS_OK;
@@ -701,6 +701,11 @@ static int push_update_ref_status(struct strbuf *buf,
701 free(msg);
702 msg = NULL;
703 }
704 + else if (!strcmp(msg, "forced update")) {
705 + forced = 1;
706 + free(msg);
707 + msg = NULL;
708 + }
709 }
710
711 if (*ref)
@@ -722,6 +727,7 @@ static int push_update_ref_status(struct strbuf *buf,
727 }
728
729 (*ref)->status = status;
730 + (*ref)->forced_update = forced;
731 (*ref)->remote_status = msg;
732 return !(status == REF_STATUS_OK);
733 }