-
-
Notifications
You must be signed in to change notification settings - Fork 954
-
Updating the submodule references in a supermodule's tree.
for so in repo.submodules:
sn = git.objects.submodule.base.Submodule(r,rr.head.commit.binsha,name=so.name,path=so.path, mode=0o160000)
repo.index.add([sn])
(A) an explicit "mode" is required. Given that anything that's not 0o160000 is very likely to break the index file this doesn't make much sense.
(B) There really should be a method that returns a new Submodule
object, either using an explicit binsha
or defaulting to the submodule's current HEAD, instead of forcing the user to create one from scratch.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments
-
In the docs for submodules there is suggestions for how the API is intended.
Generally, these are very buggy and I wouldn't use them for more than discovery. Further, the index API is superficial at best and again I don't recommend to use it especially when handling submodules. Instead, prefer repo.git.add(...)
.
Beta Was this translation helpful? Give feedback.
All reactions
-
Well, I did try repo.add(PATH)
, but that method has the unfortunate side effect of completely ignoring the fact that PATH is a submodule; it adds all the files in it to the supermodule's index instead.
The repo.index.add()
method I quoted above at least works. It's even documented.
Beta Was this translation helpful? Give feedback.