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

[PATCH 3/4] Correctly handle refs/patches on series rename

From
Yann Dirson <ydirson@altern.org>
Date
Apr 13, 2006, 21:44 UTC
Message-ID
<20060413214428.8806.38365.stgit@gandelf.nowhere.earth>
In-Reply-To
<20060413213819.8806.53300.stgit@gandelf.nowhere.earth>
From: Yann Dirson <ydirson@altern.org>

When renaming a series, the refs/patches dir was not moved, and by chance a new one was created by the repository-upgrade code, but that left the old one behind as cruft.

Also added a regression test to assert that nothing by the old name is left behind. ---

 stgit/stack.py           |    2 ++
 t/t1001-branch-rename.sh |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/stgit/stack.py b/stgit/stack.py
index f4d7490..92407e7 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -497,6 +497,8 @@ class Series:
             os.rename(self.__series_dir, to_stack.__series_dir)
         if os.path.exists(self.__base_file):
             os.rename(self.__base_file, to_stack.__base_file)
+        if os.path.exists(self.__refs_dir):
+            os.rename(self.__refs_dir, to_stack.__refs_dir)
 
         self.__init__(to_name)
 
diff --git a/t/t1001-branch-rename.sh b/t/t1001-branch-rename.sh
new file mode 100755
index 0000000..65a5280
--- /dev/null
+++ b/t/t1001-branch-rename.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Yann Dirson
+#
+
+test_description='Branch operations.
+
+Exercises the "stg branch" commands.
+'
+
+. ./test-lib.sh
+
+test_stg_init
+
+test_expect_success \
+    'Create an stgit branch from scratch' \
+    'stg branch -c foo &&
+     stg new p1 -m "p1"
+'
+
+test_expect_failure \
+    'Rename the current stgit branch' \
+    'stg branch -r foo bar
+'
+
+test_expect_success \
+    'Rename an stgit branch' \
+    'stg branch -c buz &&
+     stg branch -r foo bar &&
+     test -z `find .git -name foo | tee /dev/stderr`
+'
+
+test_done
Previous: Yann DirsonNext: Yann Dirson
Message 4 of 5 in “Add a testsuite to stgit (take 2)”
  1. 0/4 Add a testsuite to stgit (take 2)Yann Dirson, Apr 13, 2006
  2. 1/4 Add a testsuite framework copied from git-coreYann Dirson, Apr 13, 2006
  3. 2/4 Add list of bugs to TODOYann Dirson, Apr 13, 2006
  4. 3/4 Correctly handle refs/patches on series renameYann Dirson, Apr 13, 2006
  5. 4/4 Add a couple of safety checks to series creationYann Dirson, Apr 13, 2006

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.