summaryrefslogtreecommitdiff
path: root/lib/git/objects
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-20 22:03:13 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-20 22:03:13 +0100
commit7c72b9a3eaabbe927ba77d4f69a62f35fbe60e2e (patch)
tree9732e22a0e677413ec269e8b53ff31aa5b347a25 /lib/git/objects
parent8e0e315a371cdfc80993a1532f938d56ed7acee4 (diff)
parentbeccf1907dae129d95cee53ebe61cc8076792d07 (diff)
downloadgitpython-7c72b9a3eaabbe927ba77d4f69a62f35fbe60e2e.tar.gz
Merge remote branch 'gitorious/win32'
Diffstat (limited to 'lib/git/objects')
-rw-r--r--lib/git/objects/submodule/base.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/git/objects/submodule/base.py b/lib/git/objects/submodule/base.py
index 403b2e18..7e0444f1 100644
--- a/lib/git/objects/submodule/base.py
+++ b/lib/git/objects/submodule/base.py
@@ -24,6 +24,7 @@ import git
import os
import sys
+import time
import shutil
@@ -211,6 +212,12 @@ class Submodule(util.IndexObject, Iterable, Traversable):
path = path[:-1]
# END handle trailing slash
+ # assure we never put backslashes into the url, as some operating systems
+ # like it ...
+ if url != None:
+ url = to_native_path_linux(url)
+ #END assure url correctness
+
# INSTANTIATE INTERMEDIATE SM
sm = cls(repo, cls.NULL_BIN_SHA, cls.k_default_mode, path, name)
if sm.exists():
@@ -381,7 +388,11 @@ class Submodule(util.IndexObject, Iterable, Traversable):
# update the working tree
if mrepo.head.commit.binsha != binsha:
if is_detached:
- mrepo.git.checkout(hexsha)
+ # NOTE: for now we force, the user is no supposed to change detached
+ # submodules anyway. Maybe at some point this becomes an option, to
+ # properly handle user modifications - see below for future options
+ # regarding rebase and merge.
+ mrepo.git.checkout(hexsha, force=True)
else:
# TODO: allow to specify a rebase, merge, or reset
# TODO: Warn if the hexsha forces the tracking branch off the remote
@@ -576,16 +587,26 @@ class Submodule(util.IndexObject, Iterable, Traversable):
if num_branches_with_new_commits == len(rrefs):
raise InvalidGitRepositoryError("Cannot delete module at %s as there are new commits" % mod.working_tree_dir)
# END handle new commits
+ # have to manually delete references as python's scoping is
+ # not existing, they could keep handles open ( on windows this is a problem )
+ if len(rrefs):
+ del(rref)
+ #END handle remotes
+ del(rrefs)
+ del(remote)
# END for each remote
# gently remove all submodule repositories
for sm in self.children():
sm.remove(module=True, force=False, configuration=False, dry_run=dry_run)
+ del(sm)
# END for each child-submodule
# finally delete our own submodule
if not dry_run:
- shutil.rmtree(mod.working_tree_dir)
+ wtd = mod.working_tree_dir
+ del(mod) # release file-handles (windows)
+ shutil.rmtree(wtd)
# END delete tree if possible
# END handle force
# END handle module deletion