Add info about --git-ignore-branch when not on branch
authorJonathan Rubenstein <jrubcop@gmail.com>
Wed, 2 Sep 2020 02:53:47 +0000 (22:53 -0400)
committerGuido Günther <agx@sigxcpu.org>
Mon, 8 Feb 2021 10:15:20 +0000 (11:15 +0100)
Closes: #956491
gbp/scripts/buildpackage.py

index 8c489bfbd85e960828c13ae1b635c0b166700dd2..74f2c5bf144eb6d7d494bcd816932bfe26d89386 100755 (executable)
@@ -328,10 +328,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 GitRepositoryError("Use --git-ignore-branch to ignore")
 
     ignore = options.ignore_new or options.ignore_branch
     if branch != options.debian_branch and not ignore: