From: Catalin Marinas Date: Tue, 13 Feb 2007 22:26:37 +0000 (+0000) Subject: Fix the behaviour when there is no user information configured X-Git-Tag: v0.14.3~335 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/5cd9e87faa0a116ce2b378be6a5c89d5f20629f1 Fix the behaviour when there is no user information configured If there is no user.name or user.email set in the gitconfig files, just use the defaults rather than failing. Signed-off-by: Catalin Marinas --- diff --git a/stgit/git.py b/stgit/git.py index 44d5b0e..46ba5c8 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -39,6 +39,7 @@ class Person: """An author, committer, etc.""" def __init__(self, name = None, email = None, date = '', desc = None): + self.name = self.email = self.date = None if name or email or date: assert not desc self.name = name @@ -452,10 +453,7 @@ def user(): if not __user: name=config.get('user.name') email=config.get('user.email') - if name and email: - __user = Person(name, email) - else: - raise GitException, 'unknown user details' + __user = Person(name, email) return __user; def author(): diff --git a/t/t1900-mail.sh b/t/t1900-mail.sh index 6a950b4..4be7270 100755 --- a/t/t1900-mail.sh +++ b/t/t1900-mail.sh @@ -6,6 +6,7 @@ test_description='Test the mail command' test_expect_success \ 'Initialize the StGIT repository' \ ' + git config stgit.sender "A U Thor " && for i in 1 2 3 4 5; do touch foo.txt && echo "line $i" >> foo.txt && diff --git a/t/test-lib.sh b/t/test-lib.sh index 0ac7e7c..d50a3ba 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -17,11 +17,11 @@ unset COMMIT_AUTHOR_EMAIL unset COMMIT_AUTHOR_NAME unset GIT_ALTERNATE_OBJECT_DIRECTORIES unset GIT_AUTHOR_DATE -GIT_AUTHOR_EMAIL=author@example.com -GIT_AUTHOR_NAME='A U Thor' +#GIT_AUTHOR_EMAIL=author@example.com +#GIT_AUTHOR_NAME='A U Thor' unset GIT_COMMITTER_DATE -GIT_COMMITTER_EMAIL=committer@example.com -GIT_COMMITTER_NAME='C O Mitter' +#GIT_COMMITTER_EMAIL=committer@example.com +#GIT_COMMITTER_NAME='C O Mitter' unset GIT_DIFF_OPTS unset GIT_DIR unset GIT_EXTERNAL_DIFF