Fix the behaviour when there is no user information configured
authorCatalin Marinas <catalin.marinas@gmail.com>
Tue, 13 Feb 2007 22:26:37 +0000 (22:26 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 13 Feb 2007 22:26:37 +0000 (22:26 +0000)
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 <catalin.marinas@gmail.com>
stgit/git.py
t/t1900-mail.sh
t/test-lib.sh

index 44d5b0e..46ba5c8 100644 (file)
@@ -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():
index 6a950b4..4be7270 100755 (executable)
@@ -6,6 +6,7 @@ test_description='Test the mail command'
 test_expect_success \
     'Initialize the StGIT repository' \
     '
+    git config stgit.sender "A U Thor <author@example.com>" &&
     for i in 1 2 3 4 5; do
       touch foo.txt &&
       echo "line $i" >> foo.txt &&
index 0ac7e7c..d50a3ba 100755 (executable)
@@ -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