diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-19 17:04:50 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-19 17:04:50 +0100 |
commit | aaa84341f876927b545abdc674c811d60af00561 (patch) | |
tree | b4d286989570f1775b52a24a9f5503bf398fed6d /git/objects/submodule/base.py | |
parent | 20863cfe4a1b0c5bea18677470a969073570e41c (diff) | |
download | gitpython-aaa84341f876927b545abdc674c811d60af00561.tar.gz |
Submodule.move() will auto-rename the submodule if the name was equal to the path
Fixes #238
Diffstat (limited to 'git/objects/submodule/base.py')
-rw-r--r-- | git/objects/submodule/base.py | 6 |
1 files changed, 6 insertions, 0 deletions
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 |