From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Seymour Subject: [PATCH v11 3/7] bisect: add tests to document expected behaviour in presence of broken trees. Date: Mon, 1 Aug 2011 21:56:13 +1000 Message-ID: <1312199777-10144-4-git-send-email-jon.seymour@gmail.com> References: <1312199777-10144-1-git-send-email-jon.seymour@gmail.com> Cc: chriscool@tuxfamily.org, gitster@pobox.com, j6t@kdbg.org, jnareb@gmail.com, Jon Seymour To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Mon Aug 01 13:57:21 2011 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 1Qnr7Z-00062W-1C for gcvg-git-2@lo.gmane.org; Mon, 01 Aug 2011 13:57:21 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752764Ab1HAL5J (ORCPT ); Mon, 1 Aug 2011 07:57:09 -0400 Received: from mail-gw0-f46.google.com ([74.125.83.46]:32899 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752745Ab1HAL5F (ORCPT ); Mon, 1 Aug 2011 07:57:05 -0400 Received: by gwaa12 with SMTP id a12so1327459gwa.19 for ; Mon, 01 Aug 2011 04:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=NG82Bjch3mKxm6Stl9nNK84eLmC36EEx0cBjFUywdNE=; b=Ps2VEwHpQIpbInyFGwOGAxyOkMpV2ewDRXMTLqalAMC9RY8kTX8wuCSRDKSo9iL0QP VZGzm/i12nszlncZjbLio5c9AZpkaATupFpi5ZZ/yZDuYOJtfFNHP8P1ymKE9I2GB0Yu wo0skdV7bZfLPWyuQSPkGBzDnT4vIVAkpeS+U= Received: by 10.142.61.3 with SMTP id j3mr3029084wfa.102.1312199824782; Mon, 01 Aug 2011 04:57:04 -0700 (PDT) Received: from localhost.localdomain ([120.16.6.238]) by mx.google.com with ESMTPS id a4sm3060009wfm.4.2011.08.01.04.57.00 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Aug 2011 04:57:03 -0700 (PDT) X-Mailer: git-send-email 1.7.6.352.g0c69b In-Reply-To: <1312199777-10144-1-git-send-email-jon.seymour@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: If the repo is broken, we expect bisect to fail. Signed-off-by: Jon Seymour --- t/t6030-bisect-porcelain.sh | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index b3d1b14..9ae2de8 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -581,5 +581,53 @@ test_expect_success 'erroring out when using bad path parameters' ' ' # +# This creates a broken branch which cannot be checked out because +# the tree created has been deleted. # +# H1-H2-H3-H4-H5-H6-H7 <--other +# \ +# S5-S6'-S7'-S8'-S9 <--broken +# +# Commits marked with ' have a missing tree. +# +test_expect_success 'broken branch creation' ' + git bisect reset && + git checkout -b broken $HASH4 && + git tag BROKEN_HASH4 $HASH4 && + add_line_into_file "5(broken): first line on a broken branch" hello2 && + git tag BROKEN_HASH5 && + mkdir missing && + :> missing/MISSING && + git add missing/MISSING && + git commit -m "6(broken): Added file that will be deleted" + git tag BROKEN_HASH6 && + add_line_into_file "7(broken): second line on a broken branch" hello2 && + git tag BROKEN_HASH7 && + add_line_into_file "8(broken): third line on a broken branch" hello2 && + git tag BROKEN_HASH8 && + git rm missing/MISSING && + git commit -m "9(broken): Remove missing file" + git tag BROKEN_HASH9 && + rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d +' + +echo "" > expected.ok +cat > expected.missing-tree.default <error.txt && + test_cmp expected.missing-tree.default error.txt +' + +test_expect_success 'bisect fails if tree is broken on trial commit' ' + git bisect reset && + test_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt && + git reset --hard broken && + git checkout broken && + test_cmp expected.missing-tree.default error.txt +' + test_done -- 1.7.6.352.g0c69b