Skip to content

Problems with git submodules #8

Closed

Description

@Javex

Short: When I run git up it does not run on my current working directories' git repository.

Long: I have a master repository that has several submodules. To keep everything synced, I run git pull && git submodule foreach pull (and some more commands). This worked but always caused problems when pushing later. As I understand git up solves this. However, I noticed that git up seems to be running on the master each time in the submodule.

For example, the master module has the branches master and reduced while one submodule only has master and no reduced. However, this is the output produced when running above command (with only one submodule):

Fetching origin
stashing 1 changes
master   up to date
reduced  up to date
unstashing
Entering 'mysubmodule'
Fetching origin
stashing 1 changes
master   up to date
reduced  up to date
unstashing

Making things even more weird, when I go into the directory myself and do git up, the same thing happens:

stashing 1 changes
master   up to date
reduced  up to date
unstashing

There isn't even a change in this directory, only in the master. I read up on PyGit docs so I ran this: GIT_PYTHON_TRACE=y git up:

git status --porcelain --untracked-files=no
git config git-up.rebase.auto
git config git-up.rebase.log-hook
git config git-up.bundler.rbenv
git config git-up.bundler.check
git config git-up.bundler.autoinstall
git config git-up.updates.check
git config git-up.fetch.prune
git config git-up.bundler.local
git config git-up.fetch.all
git config git-up.rebase.arguments
git version
git fetch --multiple --prune origin
Fetching origin
git cat-file --batch-check
git diff HEAD --cached --abbrev=40 --full-index --raw
git diff --abbrev=40 --full-index --raw
git status --porcelain --untracked-files=no
stashing 1 changes
git stash
master   up to date
reduced  up to date
unstashing
git stash pop

It still doesn't say that much about what's really going on though :(
But I executed some of the commands myself and it does behave differently, for example git fetch --multiple --prune origin did delete a branch on the first run but not on the second, indicating this command was never executed on this repository.

Since I don't know so much about PyGitUp (or PyGit for that matter), I don't know how to debug this efficiently (I am capable of Python though, so I can assist there). I am not sure if I have a major configuration screwup or if this is a bug in PyGitUp but if someone could provide details on how to track this down, I would be very happy.

Activity

  1. msiemens commented on Mar 23, 2014

    @msiemens
    Owner

    Hey Javex! Does this problem occur, when not using submodules or only with submodules?

  2. Javex commented on May 19, 2014

    @Javex
    Author

    Sorry for the late reply, it only happens inside a submodule.

  3. changed the title [-]git up not running on current repository[/-] [+]Problems with git submodules[/+] on Jul 28, 2014
  4. msiemens commented on Feb 12, 2015

    @msiemens
    Owner

    Sorry for letting this wait for much too long! Did I hear you right that you want a git up in a repo with submodules to update every submodule, too?

  5. Javex commented on Feb 13, 2015

    @Javex
    Author

    Yes. The particular problem (which git up perfectly describes & solves) is that I need to pull and merge each branch before pushing. Since I do that with submodules (i.e. git submodule foreach git pull then git submodule foreach git push) a conflict happening anywhere in between breaks my sequence. git up does/would solve this except for the described issue

  6. msiemens commented on Feb 20, 2015

    @msiemens
    Owner

    It seems like the problem is that PyGitUp will always seek the toplevel repo (the output of git rev-parse --show-toplevel). But the git library (GitPython) has native support for submodules, so maybe we could use that. In that case, you'd run git up on the toplevel repo and PyGitUp would automatically update all submodules, too.

  7. added a commit that references this issue on Feb 21, 2015
    ba628ff
  8. msiemens commented on Feb 21, 2015

    @msiemens
    Owner

    I've updated PyGitUp so it should work. Could you try the latest dev version, if it actually works?

  9. Javex commented on Feb 21, 2015

    @Javex
    Author

    As far as I understand you, you wanted to update all submodules inclusively, too. When I run git up it does not do that. However, running git submodule foreach git up now seems to work in each directory correctly.

    I did not have any changes right now, so I could not test the actual functionality, i.e. whether it behaves correctly on all branches even if there are changes. But that's just basic git up stuff that I suppose is independent of it being a submodule.

    So in short: Thank you very much. That saves me a lot of trouble, awesome :)

  10. msiemens commented on Feb 21, 2015

    @msiemens
    Owner

    When I run git up it does not do that. However, running git submodule foreach git up now seems to work in each directory correctly.

    Yeah, I forgot to mention that PyGitUp now works with git submodule foreach [...] but itself doesn't update submodules 😄

  11. msiemens commented on Feb 23, 2015

    @msiemens
    Owner

    I've now released v1.2.2 which includes the fix :)

  12. kuboj commented on Jan 11, 2016

    @kuboj

    Yeah, I forgot to mention that PyGitUp now works with git submodule foreach [...] but itself doesn't update submodules 😄

    Is there some rationale behind this? To, by default, not update submodules if git up is executed in top directory. I was pretty confused by this behavior when I started using this port of git-up :)

  13. msiemens commented on Jan 11, 2016

    @msiemens
    Owner

    Is there some rationale behind this? To, by default, not update submodules if git up is executed in top directory. I was pretty confused by this behavior when I started using this port of git-up :)

    The rationale is that the original git-up doesn't update submodules when called from the root directory and I want to keep the behaviour of PyGitUp in line with it. Actually, the original breaks if called in a submodule (e.g. aanand/git-up#111) whereas PyGitUp handles it without errors :)

  14. kuboj commented on Jan 18, 2016

    @kuboj

    Ok, fair enough, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions