Package: git-buildpackage
Version: 0.4.43
Severity: wishlist
Tags: patch

For users who use different email addresses for different packages (for
example: for personal and work use), use the details as specified by
git's user.name and user.email by default if they are available.

The maintainer creating the release can be expected to have git
configured correctly for commits.

This applies to the trailer only so that multimaint continues to work
for changelog entries from commits as expected.
---
 gbp/git_utils.py |    6 ++++++
 git-dch          |   12 +++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index da8884e..ce4ebed 100644
--- a/gbp/git_utils.py
+++ b/gbp/git_utils.py
@@ -153,6 +153,12 @@ class GitRepository(object):
             GitRm(verbose=verbose)(files)
         return not self.is_clean()[0]
 
+    def get_config(self, name):
+        """Gets the config value associated with name"""
+        self.__check_path()
+        value, ret = self.__git_getoutput('config', [ name ])
+        if ret: raise KeyError
+        return value[0][:-1] # first line with \n ending removed
 
 def create_repo(path):
     """create a repository at path"""
diff --git a/git-dch b/git-dch
index d356422..acf1c52 100755
--- a/git-dch
+++ b/git-dch
@@ -82,11 +82,17 @@ def add_changelog_section(msg, distribution, author=None, 
email=None, version=No
     spawn_dch(msg=msg, newversion= True, version=version, author=author, 
email=email, distribution=distribution)
 
 
-def fixup_trailer():
+def fixup_trailer(repo):
     """fixup the changelog trailer's comitter and email address - it might
     otherwise point to the last git committer instead of the person creating
     the changelog"""
-    spawn_dch(msg='')
+    try: author = repo.get_config('user.name')
+    except KeyError: author = None
+
+    try: email = repo.get_config('user.email')
+    except KeyError: email = None
+
+    spawn_dch(msg='', author=author, email=email)
 
 
 def head_commit():
@@ -355,7 +361,7 @@ def main(argv):
 
         if commits:
             shortlog_to_dch(repo, commits, options)
-            fixup_trailer()
+            fixup_trailer(repo)
         elif not first_commit:
             print "No changes detected from %s to %s." % (since, until)
 
-- 
1.5.6.3




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to