From a5f1eba2761eba8987c94bf61e0a4b7528afbb5f Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Sun, 16 Apr 2006 12:52:37 +0200 Subject: [PATCH] Correctly handle refs/patches on series rename 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 (which the safety checks added in a former patch now detects). Also adds a regression test to assert that nothing by the old name is left behind. Signed-off-by: Yann Dirson --- stgit/stack.py | 2 ++ t/t1001-branch-rename.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 t/t1001-branch-rename.sh diff --git a/stgit/stack.py b/stgit/stack.py index 19bb62ab..975ac210 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -505,6 +505,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 00000000..28da15ce --- /dev/null +++ b/t/t1001-branch-rename.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright (c) 2006 Yann Dirson +# + +test_description='Branch renames. + +Exercises branch renaming commands. +' + +. ./test-lib.sh + +test_expect_success \ + 'Create an stgit branch from scratch' \ + 'stg init && + 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 -- 2.11.4.GIT