From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Shumkin Subject: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Date: Thu, 24 Jan 2013 13:10:25 +0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Alexey Shumkin , Junio C Hamano To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Jan 24 10:11:29 2013 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 1TyIqF-0002p5-PJ for gcvg-git-2@plane.gmane.org; Thu, 24 Jan 2013 10:11:28 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207Ab3AXJLB convert rfc822-to-quoted-printable (ORCPT ); Thu, 24 Jan 2013 04:11:01 -0500 Received: from mail-la0-f45.google.com ([209.85.215.45]:33273 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752482Ab3AXJK5 (ORCPT ); Thu, 24 Jan 2013 04:10:57 -0500 Received: by mail-la0-f45.google.com with SMTP id er20so4374963lab.32 for ; Thu, 24 Jan 2013 01:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:mime-version:content-type :content-transfer-encoding; bh=W5GcspYS+rONPGp61Il7lSbUMdcuUABhmgNzOiBwqyg=; b=SWGIK3lsyWG5pms4ghhP9I0i/bGGzyTbmtZPZiMneknXmpxGYYqfHAVXxOQiZ1lBfj NgivdvFE737BqPy6CbMzrzmwmrvSnHXhKJRloRhtErJvr9DcPoe4L7h6rPQLYWKp6ShI pjMOREFhkymkQrzlQ8upYbiQYfwr6HfO7q8/XztRiQstS/25wsoytOCWADYF4bVCyxBt hhEFx/nDpPsy52+Pq14LhLUyZ8WugmtxxRJclxEk9DaO36MFdZj0FVO0AJzf8lmYRWa0 hm7vFU0/kTE6+FYjjPDNTqMyNIhCxoE1sQ9U5T4Ntpeprh7796o/3UBjD5Mjvd4sErIq 4vbg== X-Received: by 10.152.132.137 with SMTP id ou9mr1170766lab.7.1359018656084; Thu, 24 Jan 2013 01:10:56 -0800 (PST) Received: from ds212plus (ppp91-77-44-105.pppoe.mtu-net.ru. [91.77.44.105]) by mx.google.com with ESMTPS id j9sm8776515lbd.13.2013.01.24.01.10.52 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Jan 2013 01:10:55 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by ds212plus (Postfix) with ESMTP id 4EA58600CC; Thu, 24 Jan 2013 13:11:35 +0400 (MSK) X-Mailer: git-send-email 1.8.1.1.10.g9255f3f In-Reply-To: In-Reply-To: References: <20110921004602.3d59bed4@zappedws> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: The expected SHA-1 digests are always available in variables. Use them instead of hardcoding. Signed-off-by: Alexey Shumkin --- t/t6006-rev-list-format.sh | 130 +++++++++++++++++++++++++------------= -------- 1 file changed, 72 insertions(+), 58 deletions(-) diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index f94f0c4..c248509 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -6,8 +6,19 @@ test_description=3D'git rev-list --pretty=3Dformat tes= t' =20 test_tick test_expect_success 'setup' ' -touch foo && git add foo && git commit -m "added foo" && - echo changed >foo && git commit -a -m "changed foo" + touch foo && + git add foo && + git commit -m "added foo" && + head1=3D$(git rev-parse --verify HEAD) && + head1_7=3D$(echo $head1 | cut -c1-7) && + echo changed >foo && + git commit -a -m "changed foo" && + head2=3D$(git rev-parse --verify HEAD) && + head2_7=3D$(echo $head2 | cut -c1-7) && + head2_parent=3D$(git cat-file -p HEAD | grep parent | cut -f 2 -d" ")= && + head2_parent_7=3D$(echo $head2_parent | cut -c1-7) && + tree2=3D$(git cat-file -p HEAD | grep tree | cut -f 2 -d" ") && + tree2_7=3D$(echo $tree2 | cut -c1-7) ' =20 # usage: test_format name format_string foo && git commit -a -F commit-msg + git config i18n.commitencoding iso8859-1 && + echo change2 >foo && git commit -a -F commit-msg && + head3=3D$(git rev-parse --verify HEAD) && + head3_7=3D$(echo $head3 | cut -c1-7) ' =20 -test_format complex-encoding %e <<'EOF' -commit f58db70b055c5718631e5c61528b28b12090cdea +test_format complex-encoding %e <expect commit f58db70b055c5718631e5c61528b28b12090cdea && + echo >expect commit $head3 && echo >>expect fooQbar && git rev-list -1 --format=3Dfoo%x00bar HEAD >actual.nul && nul_to_q actual && --=20 1.8.1.1.10.g9255f3f