aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-10 12:53:24 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-10 13:17:30 +0100
commit42878ff2e5756a6cd32f43a90c024ffadbe989c7 (patch)
tree7be27826f446b37fbc73a990b650c39018ffc67c
parente9ffa80e5ff429e6f5cd38c07036aae07416fecf (diff)
Always set a mainttrailer option
to honor --[no]-git-author This basically reverts c3258c19c6cfa291c8bebac1dae230f6e3ccca36 but also adds a test case to not break it again that easily. Closes: #796913 Thanks: David Kalnischkies for investigating
-rw-r--r--gbp/scripts/dch.py11
-rw-r--r--tests/11_test_dch_main.py12
2 files changed, 17 insertions, 6 deletions
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 2835ea9..59e920b 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -98,12 +98,11 @@ def fixup_section(repo, use_git_author, options, dch_options):
else:
gbp.log.debug("Snapshot enabled: do not fixup options in header")
- if use_git_author:
- for opt in mainttrailer_opts:
- if opt in dch_options:
- break
- else:
- opts.append(mainttrailer_opts[0])
+ for opt in mainttrailer_opts:
+ if opt in dch_options:
+ break
+ else:
+ opts.append(mainttrailer_opts[0])
ChangeLog.spawn_dch(msg='', author=author, email=email, dch_options=dch_options + opts)
diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py
index e9b6400..a9b2146 100644
--- a/tests/11_test_dch_main.py
+++ b/tests/11_test_dch_main.py
@@ -68,6 +68,8 @@ class TestScriptDch(DebianGitTestRepo):
self.options = ["--upstream-tag=%s" % self.upstream_tag, "--debian-branch=debian",
"--upstream-branch=upstream", "--id-length=0", "--spawn-editor=/bin/true"]
self.repo.create_tag(deb_tag, msg=deb_tag_msg, commit="HEAD~1")
+ self.repo.set_user_name("gbp test user")
+ self.repo.set_user_email("gbp@example.com")
def tearDown(self):
DebianGitTestRepo.tearDown(self)
@@ -387,3 +389,13 @@ class TestScriptDch(DebianGitTestRepo):
lines)
self.assertIn(""" * test non-debian closes 2 (Example: EX-5678)\n""",
lines)
+
+ def test_dch_main_git_author(self):
+ options = ["--git-author", '-S', '-a']
+ lines = self.run_dch(options)
+ self.assertIn("-- gbp test user <gbp@example.com>", lines[9])
+
+ def test_dch_main_no_git_author(self):
+ options = ["--no-git-author", '-S', '-a']
+ lines = self.run_dch(options)
+ self.assertNotIn("-- gbp test user", "\n".join(lines))