chiark / gitweb /
Using delete_patch while deleting a branch is broken
authorChuck Lever <cel@netapp.com>
Thu, 17 Nov 2005 02:39:30 +0000 (21:39 -0500)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 17 Nov 2005 10:36:37 +0000 (10:36 +0000)
"stg branch --force --delete" takes forever, and often leaves the
repository in a broken state.  The reason for this is the use of
stack.delete_patch() to delete the patches before removing the series.

The problem is delete_patch() will try to pop the patches, which changes
the head link.  After the branch deletion is complete, HEAD will point to
.git/refs/heads/current-branch, but the contents of current-branch will be
the old base of the deleted branch.

Signed-off-by: Chuck Lever <cel@netapp.com>
stgit/stack.py

index 7c6677dae065dfdaafb3121b8bcfbaa909d7fc3d..18b4c6e730c8a5082d7da586f2205adae9c34c9c 100644 (file)
@@ -427,9 +427,8 @@ class Series:
             if not force and patches:
                 raise StackException, \
                       'Cannot delete: the series still contains patches'
-            patches.reverse()
             for p in patches:
-                self.delete_patch(p)
+                Patch(p, self.__patch_dir).delete()
 
             if os.path.exists(self.__applied_file):
                 os.remove(self.__applied_file)