From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: [PATCH v6 03/23] receive-pack: do not reuse old_sha1[] for other things Date: Wed, 17 Sep 2014 15:45:38 -0700 Message-ID: <1410993958-32394-4-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:47:25 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 1XUO0S-0002Vl-Br for gcvg-git-2@plane.gmane.org; Thu, 18 Sep 2014 00:47:24 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757265AbaIQWrS (ORCPT ); Wed, 17 Sep 2014 18:47:18 -0400 Received: from smtp.pobox.com ([208.72.237.35]:57593 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756900AbaIQWqI (ORCPT ); Wed, 17 Sep 2014 18:46:08 -0400 Received: from smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id C573739DD3; Wed, 17 Sep 2014 18:46:07 -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=Uo1F astbqMWiN3jNPlddebqHm4o=; b=ouMKYAjnvAM7sJXKvs7/9TPVvQ0U1mBFwOsb kfDAoBjhUebrUgjWNOKOT2467B4n44ZoHgcNdQzWrxxKl/t4np/QIG2MDZYYrW7t XZ9i1zocof7HGiYk5FXTVqcnG83ARi0lVCsqczfkeHskYIY4Sq5mhD/iUTjBDHE2 FNtKPYM= 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=sldNGZ e/fBDb87rciLbp3eu2pEhiGiRRAmwhahMqBpFD4ihJLVI/gZl+xmH+ycmr3pUHJq jPmtL0yANT4mgkuPYy2wm1aAbQf5sAWRXmQhUHn46QSfZzQm1UgZAhJPyDMeWYKL UAhnoZnBXK0J+ResXrfb4LysBeDoR7EN5juYQ= Received: from pb-smtp0. (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id BD4C539DD2; Wed, 17 Sep 2014 18:46:07 -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 3AAA839DD1; Wed, 17 Sep 2014 18:46:07 -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: 697C403A-3EBC-11E4-A0B9-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: This piece of code reads object names of shallow boundaries, not old_sha1[], i.e. the current value the ref points at, which is to be replaced by what is in new_sha1[]. Signed-off-by: Junio C Hamano --- Unchanged since v5. builtin/receive-pack.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index a91eec8..c9b92bf 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -847,9 +847,11 @@ static struct command *read_head_info(struct sha1_array *shallow) break; if (len == 48 && starts_with(line, "shallow ")) { - if (get_sha1_hex(line + 8, old_sha1)) - die("protocol error: expected shallow sha, got '%s'", line + 8); - sha1_array_append(shallow, old_sha1); + unsigned char sha1[20]; + if (get_sha1_hex(line + 8, sha1)) + die("protocol error: expected shallow sha, got '%s'", + line + 8); + sha1_array_append(shallow, sha1); continue; } -- 2.1.0-403-g099cf47