aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDavid Engster <deng@randomsample.de>2013-04-05 21:49:19 -0600
committerJunio C Hamano <gitster@pobox.com>2013-04-07 00:39:27 -0700
commit9d9d698c43aa11d96e9beaf84d77dbceb7460fdd (patch)
tree0cd959174a49a857671989e3e8bae0a9dcb69f40 /contrib
parentbc51f7c3e2858052dcf8774bcffa217415b457c2 (diff)
downloadgit-9d9d698c43aa11d96e9beaf84d77dbceb7460fdd.tar.gz
git-9d9d698c43aa11d96e9beaf84d77dbceb7460fdd.tar.xz
remote-bzr: set author if available
[fc: added tests] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/remote-helpers/git-remote-bzr7
-rwxr-xr-xcontrib/remote-helpers/test-bzr.sh15
2 files changed, 21 insertions, 1 deletions
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index f818e93f1..a99a92412 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -266,7 +266,12 @@ def export_branch(branch, name):
tz = rev.timezone
committer = rev.committer.encode('utf-8')
committer = "%s %u %s" % (fixup_user(committer), time, gittz(tz))
- author = committer
+ authors = rev.get_apparent_authors()
+ if authors:
+ author = authors[0].encode('utf-8')
+ author = "%s %u %s" % (fixup_user(author), time, gittz(tz))
+ else:
+ author = committer
msg = rev.message.encode('utf-8')
msg += '\n'
diff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.sh
index f0672f618..1a9c8d775 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -164,4 +164,19 @@ test_expect_success 'moving directory' '
test_cmp expected actual
'
+test_expect_success 'different authors' '
+ (cd bzrrepo &&
+ echo john >> content &&
+ bzr commit -m john \
+ --author "Jane Rey <jrey@example.com>" \
+ --author "John Doe <jdoe@example.com>") &&
+
+ (cd gitrepo &&
+ git pull &&
+ git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
+
+ echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
+ test_cmp expected actual
+'
+
test_done