From: Junio C Hamano Date: Wed, 6 Feb 2013 00:12:32 +0000 (-0800) Subject: Merge branch 'ft/transport-report-segv' X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8278a7bdc19fb917860788dcff5a34c0f629dd0b;p=git.git Merge branch 'ft/transport-report-segv' A failure to push due to non-ff while on an unborn branch dereferenced a NULL pointer when showing an error message. * ft/transport-report-segv: push: fix segfault when HEAD points nowhere --- 8278a7bdc19fb917860788dcff5a34c0f629dd0b diff --cc transport.c index 384ff9acf,af442af32..886ffd8b1 --- a/transport.c +++ b/transport.c @@@ -751,17 -742,12 +751,17 @@@ void transport_print_push_status(const ref->status != REF_STATUS_UPTODATE && ref->status != REF_STATUS_OK) n += print_one_push_status(ref, dest, n, porcelain); - if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD && - *nonfastforward != NON_FF_HEAD) { + if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD) { - if (!strcmp(head, ref->name)) + if (head != NULL && !strcmp(head, ref->name)) - *nonfastforward = NON_FF_HEAD; + *reject_reasons |= REJECT_NON_FF_HEAD; else - *nonfastforward = NON_FF_OTHER; + *reject_reasons |= REJECT_NON_FF_OTHER; + } else if (ref->status == REF_STATUS_REJECT_ALREADY_EXISTS) { + *reject_reasons |= REJECT_ALREADY_EXISTS; + } else if (ref->status == REF_STATUS_REJECT_FETCH_FIRST) { + *reject_reasons |= REJECT_FETCH_FIRST; + } else if (ref->status == REF_STATUS_REJECT_NEEDS_FORCE) { + *reject_reasons |= REJECT_NEEDS_FORCE; } } }