From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Nieder Subject: [PATCH 02/24] t9300 (fast-import): avoid hard-coded object names Date: Fri, 24 Sep 2010 02:05:10 -0500 Message-ID: <20100924070510.GC4666@burratino> References: <20100701031819.GA12524@burratino> <20100701054849.GA14972@burratino> <20100817170216.GA14491@kytes> <20100905031528.GA2344@burratino> <20100905032253.GB2344@burratino> <20100924065900.GA4666@burratino> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org, "Shawn O. Pearce" , Sverre Rabbelier , David Barr , Sam Vilain To: Ramkumar Ramachandra X-From: git-owner@vger.kernel.org Fri Sep 24 09:08:06 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz2O4-0004C6-Cl for gcvg-git-2@lo.gmane.org; Fri, 24 Sep 2010 09:08:04 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755705Ab0IXHH6 (ORCPT ); Fri, 24 Sep 2010 03:07:58 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:42191 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753949Ab0IXHH6 (ORCPT ); Fri, 24 Sep 2010 03:07:58 -0400 Received: by iwn5 with SMTP id 5so2152442iwn.19 for ; Fri, 24 Sep 2010 00:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=QJSTMFHx2VgNPb7cf85jbOhjd4Usmh5JSaf2RnJXqsA=; b=VX14JnmlDmGVIDByqPDTVrQMhxOdrg0Std1r/KY4NsZm8fd9WLD6KLcLZ2M17otwOH UprzULrGUFQuxuPXLnl5dDqFQhNcrchbO0pt6ntlUp5CHV6sriH+pnkGUrFwvvGyisZE +KEygiUNyR/aXZ/JaOYWUXi9MzdXWw0UyIE4U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=asywhwVtfMYfGxRkXJ5bn/arqXpIfDBvmevW3uuQiXfaM6SsyhDqUUcxLNPnwHE/Fp FEdV+x0Q8FXEftGuZd4zFK0EovpclseMX9XY4M4gmlYZMPO55BZUmBdMEUnd0c/QG9bZ Gb9ClaX91yx4VChiPWiSzMOCSy32lkQT1Z3mk= Received: by 10.231.194.219 with SMTP id dz27mr1927365ibb.104.1285312076467; Fri, 24 Sep 2010 00:07:56 -0700 (PDT) Received: from burratino (dhcp-11-17.cs.uchicago.edu [128.135.11.176]) by mx.google.com with ESMTPS id n20sm1936694ibe.17.2010.09.24.00.07.55 (version=SSLv3 cipher=RC4-MD5); Fri, 24 Sep 2010 00:07:56 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20100924065900.GA4666@burratino> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: compare_diff_raw already ensures most (though not all) of the tests do not rely on any particular hash function, but still the attentive reader might be comforted by some less opaque object descriptions. Tested with sed -i s/compare_diff_raw/test_cmp/g t9300-fast-import.sh && sh t9300-fast-import.sh -v -i Cc: Shawn O. Pearce Signed-off-by: Jonathan Nieder --- t/t9300-fast-import.sh | 91 ++++++++++++++++++++++++++++++++--------------- 1 files changed, 62 insertions(+), 29 deletions(-) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 1eef926..ed37a4e 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -7,6 +7,8 @@ test_description='test git fast-import utility' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash +zeroes=0000000000000000000000000000000000000000 + file2_data='file2 second line of EOF' @@ -31,6 +33,14 @@ verify_packs () { done } +test_expect_success 'setup' ' + file2_id=$(echo "$file2_data" | git hash-object --stdin) && + file3_id=$(echo "$file3_data" | git hash-object --stdin) && + file4_id=$(printf "%s" "$file4_data" | git hash-object --stdin) && + file5_id=$(echo "$file5_data" | git hash-object --stdin) && + file6_id=$(echo "$file6_data" | git hash-object --stdin) +' + ### ### series A ### @@ -165,7 +175,7 @@ test_expect_success \ 'A: verify pack' \ 'verify_packs' cat >expect <actual test_expect_success \ @@ -345,9 +355,9 @@ test_expect_success \ test_cmp expect actual' cat >expect <actual test_expect_success \ @@ -387,8 +397,8 @@ test_expect_success \ 'verify_packs' cat >expect <actual test_expect_success \ @@ -557,11 +567,11 @@ test_expect_success \ 'verify_packs' cat >expect <actual test_expect_success \ @@ -698,16 +708,39 @@ M 644 :2 b/other M 644 :2 ba INPUT_END +test_expect_success 'setup: object names for expected diff' ' + some_data=$( + echo some data | + git hash-object -w --stdin + ) && + other_data=$( + echo other data | + git hash-object -w --stdin + ) && + some_tree=$( + rm -f tmp_index && + echo "100644 blob $some_data other" | + GIT_INDEX_FILE=tmp_index git update-index --index-info && + GIT_INDEX_FILE=tmp_index git write-tree + ) && + other_tree=$( + rm -f tmp_index && + echo "100644 blob $other_data other" | + GIT_INDEX_FILE=tmp_index git update-index --index-info && + GIT_INDEX_FILE=tmp_index git write-tree + ) +' + cat >expect <output && + git diff-tree L^ L >output && test_cmp expect output' ### @@ -728,7 +761,7 @@ R file2/newf file2/n.e.w.f INPUT_END cat >expect <expect <expect <expect <expect <expect <<-\EOF && - :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf - :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf + 'cat >expect <<-EOF && + :100755 100755 $newf $newf C100 file2/newf file3/newf + :100644 100644 $oldf $oldf C100 file2/oldf file3/oldf EOF subdir=$(git rev-parse refs/heads/branch^0:file2) && cat >input <<-INPUT_END && @@ -884,10 +917,10 @@ test_expect_success \ test_expect_success \ 'N: modify copied tree' \ - 'cat >expect <<-\EOF && - :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5 - :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf - :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf + 'cat >expect <<-EOF && + :100644 100644 $file5_id $file5_id C100 newdir/interesting file3/file5 + :100755 100755 $newf $newf C100 file2/newf file3/newf + :100644 100644 $oldf $oldf C100 file2/oldf file3/oldf EOF subdir=$(git rev-parse refs/heads/branch^0:file2) && cat >input <<-INPUT_END && -- 1.7.2.3