From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: [PATCH v6 10/23] send-pack: rename "new_refs" to "need_pack_data" Date: Wed, 17 Sep 2014 15:45:45 -0700 Message-ID: <1410993958-32394-11-git-send-email-gitster@pobox.com> References: <1410993958-32394-1-git-send-email-gitster@pobox.com> To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Sep 18 00:46:41 2014 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XUNzg-0002BS-L4 for gcvg-git-2@plane.gmane.org; Thu, 18 Sep 2014 00:46:36 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757185AbaIQWq3 (ORCPT ); Wed, 17 Sep 2014 18:46:29 -0400 Received: from smtp.pobox.com ([208.72.237.35]:55614 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757170AbaIQWq1 (ORCPT ); Wed, 17 Sep 2014 18:46:27 -0400 Received: from smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id 6365F39E0F; Wed, 17 Sep 2014 18:46:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references; s=sasl; bh=mI60 txSn6kkg3WxdB73BARxKlyk=; b=eywdengr4UydSHZlmt5HfQJVX7JidPPUtY8Z X/HTRCZd9xMgQC1ZaOauEqFUTAIaNvRYrPcT1u6wDRLpjlINQlm1tzJ9B9KH0BJX j9wqyckou+wJupyLExh0Z2SYGYc1MJimnuzLDQl3WDZkSWhkobIU9914VLfbzuAf LtoItNU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:in-reply-to:references; q=dns; s=sasl; b=T1QFHF 8AfoPVUBUTF+H9L2FyRWZpDmGoGvrcYo35nMtg3e2xKFpt+AvIUYMZaHhBvguv9u LVztwJeuoPy0Cg+z98ZDeS7rGXEpYePAhC8Uw3QzmWn09oraeXGC0+ez/pJolW1g dvi1lCQhtM2KYDC68Ue7qVoFWbp8cLqnXdi1c= Received: from pb-smtp0. (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id 5883A39E0E; Wed, 17 Sep 2014 18:46:27 -0400 (EDT) Received: from pobox.com (unknown [72.14.226.9]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by pb-smtp0.pobox.com (Postfix) with ESMTPSA id 4FC6A39E05; Wed, 17 Sep 2014 18:46:21 -0400 (EDT) X-Mailer: git-send-email 2.1.0-403-g099cf47 In-Reply-To: <1410993958-32394-1-git-send-email-gitster@pobox.com> X-Pobox-Relay-ID: 71E19914-3EBC-11E4-9790-BD2DC4D60FE0-77302942!pb-smtp0.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: The variable counts how many non-deleting command is being sent, but is only checked with 0-ness to decide if we need to send the pack data. Signed-off-by: Junio C Hamano --- Unchanged since v5. send-pack.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/send-pack.c b/send-pack.c index 0cb44ab..716c11b 100644 --- a/send-pack.c +++ b/send-pack.c @@ -220,7 +220,7 @@ int send_pack(struct send_pack_args *args, struct strbuf req_buf = STRBUF_INIT; struct strbuf cap_buf = STRBUF_INIT; struct ref *ref; - int new_refs; + int need_pack_data = 0; int allow_deleting_refs = 0; int status_report = 0; int use_sideband = 0; @@ -276,13 +276,12 @@ int send_pack(struct send_pack_args *args, /* * Finally, tell the other end! */ - new_refs = 0; for (ref = remote_refs; ref; ref = ref->next) { if (!ref_update_to_be_sent(ref, args)) continue; if (!ref->deletion) - new_refs++; + need_pack_data = 1; if (args->dry_run) { ref->status = REF_STATUS_OK; @@ -327,7 +326,7 @@ int send_pack(struct send_pack_args *args, in = demux.out; } - if (new_refs && cmds_sent) { + if (need_pack_data && cmds_sent) { if (pack_objects(out, remote_refs, extra_have, args) < 0) { for (ref = remote_refs; ref; ref = ref->next) ref->status = REF_STATUS_NONE; -- 2.1.0-403-g099cf47