Skip to content

git-add doesn't seem to work on submodules #335

@kgadek

Description

@kgadek

It seems that index.add doesn't work with submodules. Found exactly same issue/question on stackoverflow.

Reproduction

First, some shell:

git init master_repo
cd master_repo
echo "First" > progress_simulator
git add progress_simulator
git commit -m 'First commit'
git submodule add -b master git@github.com:gitpython-developers/GitPython.git subrepo
git commit -m 'Second commit: subrepo'

Now, the Python:

import git
master_repo = git.Repo('.')
[subrepo_sm] = master_repo.submodules
subrepo = git.Repo(subrepo_sm.path)
with open('subrepo/interference.txt', 'w'): pass
subrepo.index.add(['interference.txt'])
subrepo.index.commit('My intrusion into this project')
master_repo.index.add([subrepo_sm])

Expected vs result

I expected to see master_repo index acknowledge that the subrepo submodule pointer changed. However, nothing happens.

System info

$ python -V
Python 3.4.3

$ git --version
git version 2.4.2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy