Skip to contentSkip to conversation

Branch renaming bugfix

PATCH New Karl Hasselström 1 participant 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover Branch renaming bugfix

This series consists of a test that demonstrates a bug in the branch renaming (failure to rename the branch.<branchname>.stgit section), and a fix.

Signature · 2 lines
Karl Hasselström, [email protected]
      www.treskal.com/kalle
#1 lore raw

PATCH 1/2 Test that all branch config information is renamed

This test currently fails (which is precisely why it's needed, of course.) This is bug 9692 in the bug tracker.

---

 t/t1001-branch-rename.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
t/t1001-branch-rename.sh +2 -1
index 28da15c..28af8ae 100755
@@ -26,7 +26,8 @@ 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 -z `find .git -name foo | tee /dev/stderr` &&
+     test -z $(git config -l | grep branch\\.foo)
 '
 
 test_done
#2 lore raw

PATCH 2/2 Rename all config sections of a branch

In reply to Karl Hasselström

Just renaming the branch.branchname section doesn't rename the branch.branchname.stgit section -- we have to do that explicitly.

This fixes bug 9692.

---

 stgit/stack.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
stgit/stack.py +2 -2
index dbd7ea4..9c15b3f 100644
@@ -616,8 +616,8 @@ class Series(PatchSet):
                    self.get_name(), to_stack.get_name())
 
         # Rename the config section
-        config.rename_section("branch.%s" % self.get_name(),
-                              "branch.%s" % to_name)
+        for k in ['branch.%s', 'branch.%s.stgit']:
+            config.rename_section(k % self.get_name(), k % to_name)
 
         self.__init__(to_name)