Repository navigation
Description
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
msiemens commentedon Mar 23, 2014
Hey Javex! Does this problem occur, when not using submodules or only with submodules?
Javex commentedon May 19, 2014
Sorry for the late reply, it only happens inside a submodule.
[-]git up not running on current repository[/-][+]Problems with git submodules[/+]msiemens commentedon Feb 12, 2015
Sorry for letting this wait for much too long! Did I hear you right that you want a
git upin a repo with submodules to update every submodule, too?Javex commentedon Feb 13, 2015
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 pullthengit submodule foreach git push) a conflict happening anywhere in between breaks my sequence. git up does/would solve this except for the described issuemsiemens commentedon Feb 20, 2015
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 rungit upon the toplevel repo and PyGitUp would automatically update all submodules, too.Work in submodule if possible
msiemens commentedon Feb 21, 2015
I've updated PyGitUp so it should work. Could you try the latest dev version, if it actually works?
Javex commentedon Feb 21, 2015
As far as I understand you, you wanted to update all submodules inclusively, too. When I run
git upit does not do that. However, runninggit submodule foreach git upnow 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 :)
msiemens commentedon Feb 21, 2015
Yeah, I forgot to mention that PyGitUp now works with
git submodule foreach [...]but itself doesn't update submodules 😄msiemens commentedon Feb 23, 2015
I've now released
v1.2.2which includes the fix :)kuboj commentedon Jan 11, 2016
Is there some rationale behind this? To, by default, not update submodules if
git upis executed in top directory. I was pretty confused by this behavior when I started using this port of git-up :)msiemens commentedon Jan 11, 2016
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 :)
kuboj commentedon Jan 18, 2016
Ok, fair enough, thanks.