git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] Fix removal of series with non-existant trash dir.

From
Yann Dirson <ydirson@altern.org>
Date
Jun 6, 2007, 21:05 UTC
Message-ID
<20070606210517.7657.97905.stgit@gandelf.nowhere.earth>
In-Reply-To
<20070606205852.7657.69286.stgit@gandelf.nowhere.earth>

Otherwise it is not possible to delete a stack that never had a patch deleted (eg. a newborn stack).

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 stgit/stack.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/stgit/stack.py b/stgit/stack.py
index 26b0561..30fcca7 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -679,10 +679,11 @@ class Series(StgitObject):
             for p in patches:
                 Patch(p, self.__patch_dir, self.__refs_dir).delete()
 
-            # remove the trash directory
-            for fname in os.listdir(self.__trash_dir):
-                os.remove(os.path.join(self.__trash_dir, fname))
-            os.rmdir(self.__trash_dir)
+            # remove the trash directory if any
+            if os.path.exists(self.__trash_dir):
+                for fname in os.listdir(self.__trash_dir):
+                    os.remove(os.path.join(self.__trash_dir, fname))
+                os.rmdir(self.__trash_dir)
 
             # FIXME: find a way to get rid of those manual removals
             # (move functionality to StgitObject ?)
Previous: Yann DirsonNext: Yann Dirson
Message 2 of 6 in “Fix issues with series deletion”
  1. 0/2 Fix issues with series deletionYann Dirson, Jun 6, 2007
  2. 1/2 Fix removal of series with non-existant trash dir.Yann Dirson, Jun 6, 2007
  3. 2/2 Fix removal of series to nuke the formatversion config item.Yann Dirson, Jun 6, 2007
  4. Catalin MarinasJun 7, 2007
  5. Yann DirsonJun 9, 2007
  6. Catalin MarinasJun 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.