From: Yann Dirson Date: Sun, 16 Apr 2006 10:52:37 +0000 (+0200) Subject: Correctly handle refs/patches on series rename X-Git-Tag: v0.14.3~506 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/a5f1eba2761eba8987c94bf61e0a4b7528afbb5f 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 --- diff --git a/stgit/stack.py b/stgit/stack.py index 19bb62a..975ac21 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 0000000..28da15c --- /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