diff mbox series

b4: allow test run when source is not in git

Message ID CAODfWeFXwz4Ci5A=VaUvmyZL2daYe48+OOrjvq6wC-KTJS4hRA@mail.gmail.com (mailing list archive)
State Accepted
Headers show
Series b4: allow test run when source is not in git | expand

Commit Message

Héctor Orón Martínez Feb. 12, 2023, 12:41 p.m. UTC
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,

Comments

Konstantin Ryabitsev March 3, 2023, 8:28 p.m. UTC | #1
On Sun, Feb 12, 2023 at 01:41:40PM +0100, Héctor Orón Martínez wrote:
> 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.

Thank you. I didn't take the patch, as it wasn't quite what was needed, but
there is a fix in place now that should allow running tests from tarball
sources.

I will backport it to 0.12-stable.

Thanks,
-K
Konstantin Ryabitsev March 10, 2023, 7:59 p.m. UTC | #2
On Sun, 12 Feb 2023 13:41:40 +0100, Héctor Orón Martínez wrote:
> From c1f039a75378b804f9b8b14c0af947487b4f954a Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?H=C3=A9ctor=20Or=C3=B3n=20Mart=C3=ADnez?= <zumbi@debian.org>
> 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
> 
> [...]

Applied, thanks!

[1/1] b4: allow test run when source is not in git
      commit: bd1bf7905f2f9c2340b75b5074285105a6fa35f3

Best regards,
diff mbox series

Patch

From c1f039a75378b804f9b8b14c0af947487b4f954a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?H=C3=A9ctor=20Or=C3=B3n=20Mart=C3=ADnez?= <zumbi@debian.org>
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 <zumbi@debian.org>
---
 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