From patchwork Sun Feb 12 12:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= X-Patchwork-Id: 13137413 Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89E92A2D for ; Sun, 12 Feb 2023 12:41:52 +0000 (UTC) Received: by mail-vs1-f42.google.com with SMTP id h19so10404494vsv.13 for ; Sun, 12 Feb 2023 04:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=wzxIUYYEYLmL092chqRj0P4Wp7Zg6oVEjrTQ2uIZlFk=; b=DHkkbvSKCM947cWOlM67GzeoWlB9+FthyVB7Ho6vj7TyJ/5qyCxFTnJjs13kCHcx1z zNLRtNgMMY+tE0Pftto+tZZz0yJXQqieEkZCjMxJL2Uw/ul15oLkhyfTdS0MYgr2C8wY 9QM3TqUA+o8O3jTzDDGCpnEUFGNQjm6i2u/mNAHqC1V5SplthLHmOTYfKBI4w6H9VWFF IWBNEEykgIPw9cAeKWJ8ImhhWbANp0Hwt28SpxBN4RJ6kOsIBIRzuoVkToElH3jwqM8P k7BR25Fgh1jDQKX208aKF8GsSX0Of6si1jal/iD+8sgV2HQCTpg2rp5tA6tOYAAo5oCh Vj0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wzxIUYYEYLmL092chqRj0P4Wp7Zg6oVEjrTQ2uIZlFk=; b=pN9V4K0n7EKsPAYQObHGuRBbbSfNC189K4qil6SJEUZlk1lgPWGCb9YwaunBNv7TQa 7+RDXsDUtpM+rpDAlTNnlV0tZBIKAs7Al5LGxVTjEGhJSx6cCfA6C4egItEUsMM82JLB ZnWDYwqw/dBBn/aBew+MrcnUDuiKjC4gsQMcZP/NwKTnsGIQZMt3wTokqNN43aiH4Ip4 PtKuaXsW6s0LbCpFhOYjRuOIeuLP9ObDyxM7Z1PG1y2qCd9StD3F7cK3oJA/IuodbC3z EZiXrwKXkt6tYqe1d3KsjdMTvVEifhkzIpoXMzbvxXKxoFfJ/NNVXYqjmWbpZGf/oyHR pEew== X-Gm-Message-State: AO0yUKWMGnqBCDHNAZKn9LNI7OxqP+PAV8gjk4f7nXteTpizZ9RB+mbL TAZpf2qRldd6Di4FsnXrvgQUTh9/7SJrGGTI7ESdKHBo X-Google-Smtp-Source: AK7set/w58YHDZbQKN2rS0T3eg2xXRAb1W0mPsrF5gE6pE1wM4fF5u2PeMq22zzxAnz/vi4WqucjQSfKG7joK3RRh98= X-Received: by 2002:a05:6102:340b:b0:3f7:f257:3022 with SMTP id p11-20020a056102340b00b003f7f2573022mr4229949vsi.55.1676205711114; Sun, 12 Feb 2023 04:41:51 -0800 (PST) Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= Date: Sun, 12 Feb 2023 13:41:40 +0100 Message-ID: Subject: b4: allow test run when source is not in git To: tools@linux.kernel.org Cc: "konstantin@linuxfoundation.org" Hello Konstantin, I am maintaining the b4 Debian package and we got a build failure when running the tests due to the use of git rev-parse. https://bugs.debian.org/1031130 I have included the following local patch to remediate the immediate issue, which I would like you to consider adding to the b4 source tree. With kind regards find patch attached, From c1f039a75378b804f9b8b14c0af947487b4f954a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Or=C3=B3n=20Mart=C3=ADnez?= Date: Sun, 12 Feb 2023 13:37:56 +0100 Subject: [PATCH] allow test run when source is not in git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Héctor Orón Martínez --- b4/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/b4/__init__.py b/b4/__init__.py index 4d5a6c9..9d203cc 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -2955,10 +2955,13 @@ def git_branch_contains(gitdir, commit_id): def git_get_toplevel(path: Optional[str] = None) -> Optional[str]: topdir = None # Are we in a git tree and if so, what is our toplevel? - gitargs = ['rev-parse', '--show-toplevel'] - lines = git_get_command_lines(path, gitargs) - if len(lines) == 1: - topdir = lines[0] + if git_get_command_lines(path, ['rev-parse', '--is-inside-work-tree']): + gitargs = ['rev-parse', '--show-toplevel'] + lines = git_get_command_lines(path, gitargs) + if len(lines) == 1: + topdir = lines[0] + else: + topdir = os.getcwd() return topdir -- 2.39.1