From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS54825 139.178.88.0/22 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 7C94C1F44D for ; Sat, 30 Mar 2024 08:11:56 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=schinagl.nl header.i=@schinagl.nl header.a=rsa-sha256 header.s=7of9 header.b=Widzi2fh; dkim=pass (1024-bit key) header.d=schinagl.nl header.i=@schinagl.nl header.a=rsa-sha256 header.s=7of9 header.b=A9tzBa23; dkim-atps=neutral Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BD9762831FA for ; Sat, 30 Mar 2024 08:11:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 396FD8BE2; Sat, 30 Mar 2024 08:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=schinagl.nl header.i=@schinagl.nl header.b="Widzi2fh"; dkim=pass (1024-bit key) header.d=schinagl.nl header.i=@schinagl.nl header.b="A9tzBa23" Received: from 7of9.schinagl.nl (7of9.schinagl.nl [185.238.129.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CF4A79D8 for ; Sat, 30 Mar 2024 08:11:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.238.129.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711786307; cv=none; b=h6pcho0ZI1z9+zBrAJmFdAQsBZftAlQaDCrTEpINq7nxXP353jiSN1AQ/AR5gAMxB+Mk0LjJFBROmPK+s+gGmXeGKWvYxTSKTe9jkUh4cF5aJXf+NrNvv7KnBB+fj7UmgNZ+ywwdxbQX3YyQ3bQbxEKlTWTcJQMvHcqtQ3gY29I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711786307; c=relaxed/simple; bh=+ip4Gdq1shhEWR8BYlq+QEc3ATA7ClSerVDIREZwEFY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FJBh8UUgDThkM0kPBtMOCj3sDUcUZKjnhCb5vOilLbBofMAgZFcCaqAanAxY3KsQPVqxKbqaEPKizzt1HOilIT11SrwTewmAt/Zcg+huv0VAn7tpvf75e5tbZ7mW1BGuES2+Q75EjTD1Uur7goGe9TMJXDjf9JErqtvfJiN3Qf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=schinagl.nl; spf=pass smtp.mailfrom=schinagl.nl; dkim=pass (1024-bit key) header.d=schinagl.nl header.i=@schinagl.nl header.b=Widzi2fh; dkim=pass (1024-bit key) header.d=schinagl.nl header.i=@schinagl.nl header.b=A9tzBa23; arc=none smtp.client-ip=185.238.129.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=schinagl.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=schinagl.nl Received: from localhost (7of9.are-b.org [127.0.0.1]) by 7of9.schinagl.nl (Postfix) with ESMTP id BD3D71A0A7C4; Sat, 30 Mar 2024 09:11:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=schinagl.nl; s=7of9; t=1711786294; bh=+ip4Gdq1shhEWR8BYlq+QEc3ATA7ClSerVDIREZwEFY=; h=From:To:Cc:Subject:Date; b=Widzi2fh8/zFK/RYjIiAUmbA0ayIsRsrBnV7lyqyThgf55WJpwKsm0BPzSaIGJTB6 5R9QqJKwC9/Avf7g61g0s8Dgatz9Ho1JAvGCPl2ORnKsRf2EkquybYihqF/ZAL67mJ d0qUHP2x5Q1VbXcKa6BqTQzayXcDMejkpmcY1ESE= X-Virus-Scanned: amavisd-new at schinagl.nl Received: from 7of9.schinagl.nl ([127.0.0.1]) by localhost (7of9.schinagl.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o_8nqL_Xo1Dm; Sat, 30 Mar 2024 09:11:33 +0100 (CET) Received: from 2of9.are-b.org (unknown [10.2.12.48]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by 7of9.schinagl.nl (Postfix) with ESMTPSA id CECF61A0A7BF; Sat, 30 Mar 2024 09:11:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=schinagl.nl; s=7of9; t=1711786292; bh=+ip4Gdq1shhEWR8BYlq+QEc3ATA7ClSerVDIREZwEFY=; h=From:To:Cc:Subject:Date; b=A9tzBa23KNk3kMc1D0HaReIji99WuHKLlO4SvbBZgU8uHTzFNyb8K+DcXmGBMNoFS wuCNJTcuXV89rNON4Pxc13sAbJLEft385WxLAw65FUHycpIl4D01/XBoHpavL1Z4+/ bI4LDVRqEOmUXXnA8xHogKBJ/1r+2KR7yDKx4FaQ= From: Olliver Schinagl To: git@vger.kernel.org Cc: Junio C Hamano , Christian Couder , Stefan Haller , Olliver Schinagl Subject: [RFC] bisect: Introduce skip-when to automatically skip commits Date: Sat, 30 Mar 2024 09:10:27 +0100 Message-ID: <20240330081026.362962-2-oliver@schinagl.nl> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Before I go dig myself in deeper, I'd like some feedback and opinions on whether this is the correct direction. If I got it right, do say so, as then I can start adding some tests and update the documentation. Olliver --- In some situations, it is needed to skip certain commits when bisecting, because the compile doesn't work, or tests are known to fail. For this purpose, we introduce the `--skip-when` flag which takes a script as an input and is expected to return exit code 125 if a commit is to be skipped, which uses a regular `git bisect skip` and the commit thus ends up on the skipped pile. In addition we also offer a git-hook, to make this as predictable and painless as possible. The script can do whatever it wants to to determine if a commit is to be skipped; From comparing the hash against a known list, to checking git notes for a keyword or, as the included example, the commit body. Signed-off-by: Olliver Schinagl --- bisect.c | 2 + builtin/bisect.c | 93 +++++++++++++++++++++++- templates/hooks--bisect-skip_when.sample | 10 +++ 3 files changed, 101 insertions(+), 4 deletions(-) create mode 100755 templates/hooks--bisect-skip_when.sample diff --git a/bisect.c b/bisect.c index 60aae2fe50..185909cca9 100644 --- a/bisect.c +++ b/bisect.c @@ -476,6 +476,7 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK") static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN") static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START") +static GIT_PATH_FUNC(git_path_bisect_skip_when, "BISECT_SKIP_WHEN") static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG") static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") @@ -1179,6 +1180,7 @@ int bisect_clean_state(void) unlink_or_warn(git_path_bisect_log()); unlink_or_warn(git_path_bisect_names()); unlink_or_warn(git_path_bisect_run()); + unlink_or_warn(git_path_bisect_skip_when()); unlink_or_warn(git_path_bisect_terms()); unlink_or_warn(git_path_bisect_first_parent()); /* diff --git a/builtin/bisect.c b/builtin/bisect.c index 9891cf2604..6870142b85 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -4,6 +4,7 @@ #include "environment.h" #include "gettext.h" #include "hex.h" +#include "hook.h" #include "object-name.h" #include "oid-array.h" #include "parse-options.h" @@ -14,19 +15,21 @@ #include "revision.h" #include "run-command.h" #include "strvec.h" +#include "wrapper.h" static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK") static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START") +static GIT_PATH_FUNC(git_path_bisect_skip_when, "BISECT_SKIP_WHEN") static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG") static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN") #define BUILTIN_GIT_BISECT_START_USAGE \ - N_("git bisect start [--term-(new|bad)= --term-(old|good)=]" \ - " [--no-checkout] [--first-parent] [ [...]] [--]" \ - " [...]") + N_("git bisect start [--term-(new|bad)= --term-(old|good)=]\n" \ + " [--no-checkout] [--first-parent] [--skip-when=