Add authentication capability to the mail command
[stgit] / stgit / stack.py
index 851f998..cef4ae5 100644 (file)
@@ -284,18 +284,15 @@ class Series:
         """
         if len(self.get_applied()) == 0:
             head = git.get_head()
-            if os.path.exists(self.__base_file):
-                raise StackException, 'stack empty but the base file exists'
             write_string(self.__base_file, head)
 
     def __end_stack_check(self):
-        """Remove .git/refs/heads/base if the stack is empty
+        """Remove .git/refs/heads/base if the stack is empty.
+        This warning should never happen
         """
-        if len(self.get_applied()) == 0:
-            if not os.path.exists(self.__base_file):
-                print 'Warning: stack empty but the base file is missing'
-            else:
-                os.remove(self.__base_file)
+        if len(self.get_applied()) == 0 \
+           and read_string(self.__base_file) != git.get_head():
+            print 'Warning: stack empty but the HEAD and base are different'
 
     def head_top_equal(self):
         """Return true if the head and the top are the same
@@ -384,6 +381,8 @@ class Series:
             descr = edit_file(None, \
                               'Please enter the description for patch "%s" ' \
                               'above.' % name)
+        else:
+            descr = message
 
         head = git.get_head()