From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Seymour Subject: [PATCH v14 3/8] bisect: add tests to document expected behaviour in presence of broken trees. Date: Wed, 3 Aug 2011 08:15:57 +1000 Message-ID: <1312323362-20096-4-git-send-email-jon.seymour@gmail.com> References: <1312323362-20096-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 Wed Aug 03 00:16:57 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 1QoNGi-000433-T4 for gcvg-git-2@lo.gmane.org; Wed, 03 Aug 2011 00:16:57 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755748Ab1HBWQf (ORCPT ); Tue, 2 Aug 2011 18:16:35 -0400 Received: from mail-pz0-f42.google.com ([209.85.210.42]:47511 "EHLO mail-pz0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755731Ab1HBWQa (ORCPT ); Tue, 2 Aug 2011 18:16:30 -0400 Received: by mail-pz0-f42.google.com with SMTP id 37so375496pzk.1 for ; Tue, 02 Aug 2011 15:16:30 -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=ggcTVUT67e7V/BGXqaEgkvWdSJ7jT4l6eUmuA49Fm9Q=; b=xqmuyfrYPisY9AMGWIpwaC/freOO5oXyFGXK7W27FE2pBQUGUFyOQBmRyoPT6swo5S 67GVxWVwthM1eVqYaFHA6R3WTO2jcg6a/tf/hwmv0ei5m5tQb1lr1leU6y/sryO9fWgu dTdk9aQhsiASkWmEc/wi0D27iD/+SiwehytPA= Received: by 10.68.17.195 with SMTP id q3mr10215pbd.255.1312323390165; Tue, 02 Aug 2011 15:16:30 -0700 (PDT) Received: from localhost.localdomain ([120.16.93.94]) by mx.google.com with ESMTPS id d3sm269987pbg.44.2011.08.02.15.16.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Aug 2011 15:16:29 -0700 (PDT) X-Mailer: git-send-email 1.7.6.353.gb3ae7e In-Reply-To: <1312323362-20096-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.353.gb3ae7e