Source: git-buildpackage
Severity: wishlist
Tags: patch

Dear Maintainer,

I noticed that checking out a tag wouldn't let me use gbp buildpackage.
I checked the manual and tried --git-ignore-branch, which allowed me to
build.

The error message comes from the get_branch function, and informs me
that I am not currently on a branch. I figure this could be more
informative, so it now outputs "Use --git-ignore-branch to ignore"
as well.

Should this provide even more info?

Thank you,
Jonathan

---
 gbp/scripts/buildpackage.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 9b3d67fa..7ce50628 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -326,10 +326,11 @@ def check_branch(repo, options):
     branch = None
     try:
         branch = repo.get_branch()
-    except GitRepositoryError:
+    except GitRepositoryError as repo_error:
         # Not being on any branch is o.k. with --git-ignore-branch
         if not options.ignore_branch:
-            raise
+            gbp.log.err(repo_error)
+            raise GbpError("Use --git-ignore-branch to ignore")
      ignore = options.ignore_new or options.ignore_branch
     if branch != options.debian_branch and not ignore:
--
2.25.1

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-4-amd64 (SMP w/12 CPU cores)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8), LANGUAGE=fi:en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- no debconf information

Reply via email to