chiark / gitweb /
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 44d5b0e9ba22a6f94910eaf9f69b6b39fbb1afe5..46ba5c8614e892e44ede8816f8d19fb76fe6baef 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 6a950b4b67650e0d1fef1cebd161eda919c122e0..4be7270ca8c173dd2154cdcb2406cc0e692c1c61 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 0ac7e7c4c80cd579eb3ecd23a851e109ba8abe01..d50a3badb24008d38fc35a3e2e118e4952a8b505 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