Skip to content

Commit ca3fdbe

Browse files
committed
submodule.update: now forcing the checkout - see in-code comments
1 parent 8f24f95 commit ca3fdbe

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "gitdb"]
2-
path = lib/git/ext/gitdb
3-
url = git://gitorious.org/git-python/gitdb.git
1+
[submodule "gitdb"]
2+
path = lib/git/ext/gitdb
3+
url = git://gitorious.org/git-python/gitdb.git

‎lib/git/objects/submodule/base.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ def update(self, recursive=False, init=True, to_latest_revision=False):
387387
# update the working tree
388388
if mrepo.head.commit.binsha != binsha:
389389
if is_detached:
390-
mrepo.git.checkout(hexsha)
390+
# NOTE: for now we force, the user is no supposed to change detached
391+
# submodules anyway. Maybe at some point this becomes an option, to
392+
# properly handle user modifications - see below for future options
393+
# regarding rebase and merge.
394+
mrepo.git.checkout(hexsha, force=True)
391395
else:
392396
# TODO: allow to specify a rebase, merge, or reset
393397
# TODO: Warn if the hexsha forces the tracking branch off the remote

0 commit comments

Comments
 (0)