From aaa84341f876927b545abdc674c811d60af00561 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 19 Jan 2015 17:04:50 +0100 Subject: Submodule.move() will auto-rename the submodule if the name was equal to the path Fixes #238 --- git/objects/submodule/base.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'git/objects/submodule/base.py') diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index f5ff457d..285d2423 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -675,6 +675,7 @@ class Submodule(util.IndexObject, Iterable, Traversable): # rename the index entry - have to manipulate the index directly as # git-mv cannot be used on submodules ... yeah + previous_sm_path = self.path try: if configuration: try: @@ -701,6 +702,11 @@ class Submodule(util.IndexObject, Iterable, Traversable): raise # END handle undo rename + # Auto-rename submodule if it's name was 'default', that is, the checkout directory + if previous_sm_path == self.name: + self.rename(module_checkout_path) + # end + return self @unbare_repo -- cgit v1.2.1