From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Shumkin Subject: [PATCH v5 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Date: Thu, 20 Jun 2013 13:26:17 +0400 Message-ID: <3aff7ccae2f7e8b1499b4e11a65c5815b06c1959.1371720245.git.Alex.Crezoff@gmail.com> 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 Jun 20 11:27:01 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 1Upb8s-0002zW-C7 for gcvg-git-2@plane.gmane.org; Thu, 20 Jun 2013 11:26:58 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965225Ab3FTJ0x convert rfc822-to-quoted-printable (ORCPT ); Thu, 20 Jun 2013 05:26:53 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:45884 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935297Ab3FTJ0u (ORCPT ); Thu, 20 Jun 2013 05:26:50 -0400 Received: by mail-lb0-f181.google.com with SMTP id w10so5521489lbi.26 for ; Thu, 20 Jun 2013 02:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rarus.ru; s=google; h=sender: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=81C/qBW8dmVz9OnmkR6KL3ORnCrWGlRetoNllIHTrFY=; b=EcxEZ7dmAAUdH+vm8dgJ+bZnD2QWXyAAqLHIZTZm3nVRJsaJ4Kn6RFEoLFVrGdPi/3 wxC1ScS9FKQ5P1l3DFek4fhNshCSH1253Fu2QyubLNYLFXn5sV6eClFL+qpdWn3o9dS1 ovHvPvnTdWv+YmUITQfyts5JaobYtvn1FhE7c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender: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=81C/qBW8dmVz9OnmkR6KL3ORnCrWGlRetoNllIHTrFY=; b=IoBZtGY+36/gT1n7xv72yWFRk4JnwDEO5+ieYAWCzT9BSBiAkREcff6axwy/iABfdF 5+29A0IF/EzULUb4/vjYRmtmSJl9HeEWNiAOn8zooyNwHWI7NQ4UfKcUkD1/3nzRy6hi pbgK4t29q8QDcxCWZhqJKIy0skFer3uBXHGCCOSzoJvVwpZWv02qtVcSgolIkBspMegS 2tWIgZMfqRPGKpnQ7bNtWQIC4DHFMAxVhKUoH+HhxlDZsuX03qnkuWWfOgGStLA4ah78 LJIpkBBZMjGPQmzwUN4ZKjnVnQf3vkzDRK/bNwzX4m1mGEz829oOzpxxSEuh1AaTWKY4 z27w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=81C/qBW8dmVz9OnmkR6KL3ORnCrWGlRetoNllIHTrFY=; b=VtweTTy+cJyWp3wL2blS3KUoUi8yO8OrNPz3ayslJW/ApvukbzsruxInkZxhOJq2JI fir1B0VaMX4f/037I4vhXBQ05wV9Zm01OCxVVTfSMJt/b6miykQxGzZQh/UAWZkaLsdT C9Goxw6g/GIQX5+U3nWPgGq9RDv4q3liT7AKD5SoX3wz6ipVJ4q9MuYmrbD2sjkITcFW x0sF1YTnAQ/C6Da2STU2SLZ8MFmki92zc6+z9S/fH33FDFlLzS7WBhZsDy0Vh6/T0SbQ xCKXO9UDoX5IYKUETNKu5JehNeYjXe/tRVDwwmHaEkCwCfJHo7Q70tt3UPrswwzbpVJ1 X1KA== X-Received: by 10.112.219.133 with SMTP id po5mr4990031lbc.80.1371720408912; Thu, 20 Jun 2013 02:26:48 -0700 (PDT) Received: from localhost ([85.21.218.130]) by mx.google.com with ESMTPSA id u1sm10770636lag.5.2013.06.20.02.26.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 20 Jun 2013 02:26:48 -0700 (PDT) X-Mailer: git-send-email 1.8.3.1.15.g5c23c1e In-Reply-To: In-Reply-To: References: X-Gm-Message-State: ALoCoQkwNwcZcTNst+YRRj5kDzBidRm2QRVvkY0ttZDYtHqDqAwAIog3wvcSCvbyeQWJjYFJEvPR 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 | 142 +++++++++++++++++++++++++------------= -------- 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 0393c9f..d32e65e 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -7,8 +7,21 @@ 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" + : >foo && + git add foo && + git commit -m "added foo" && + head1=3D$(git rev-parse --verify HEAD) && + head1_short=3D$(git rev-parse --short $head1) && + tree1=3D$(git cat-file commit HEAD | sed -n -e "s/^tree //p" -e "/^$/= q") && + tree1_short=3D$(git rev-parse --short $tree1) && + echo changed >foo && + git commit -a -m "changed foo" && + head2=3D$(git rev-parse --verify HEAD) && + head2_short=3D$(git rev-parse --short $head2) && + head2_parent=3D$(git cat-file commit HEAD | sed -n -e "s/^parent //p"= -e "/^$/q") && + head2_parent_short=3D$(git rev-parse --short $head2_parent) && + tree2=3D$(git cat-file commit HEAD | sed -n -e "s/^tree //p" -e "/^$/= q") && + tree2_short=3D$(git rev-parse --short $tree2) ' =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_short=3D$(git rev-parse --short $head3) ' =20 -test_format complex-encoding %e <<'EOF' -commit 1ed88da4a5b5ed8c449114ac131efc62178734c3 +test_format complex-encoding %e <expect commit 1ed88da4a5b5ed8c449114ac131efc62178734c3 && + echo >expect commit $head3 && echo >>expect fooQbar && git rev-list -1 --format=3Dfoo%x00bar HEAD >actual.nul && nul_to_q actual && --=20 1.8.3.1.15.g5c23c1e