git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* "git push --recurse-submodules=on-demand" regression
@ 2017-06-27 16:23 Jonathan Nieder
  0 siblings, 0 replies; only message in thread
From: Jonathan Nieder @ 2017-06-27 16:23 UTC (permalink / raw)
  To: git; +Cc: evandrocoan

From: evandrocoan <evandrocoan@hotmail.com>

Originally posted on:

https://github.com/git-for-windows/git/issues/1212

My git version is:
git --version --build-options

git version 2.13.0.windows.1
built from commit: eba7af3dbb4c846c6303c5f64102acee696c9ab0
sizeof-long: 4
machine: x86

cmd.exe /c ver
Microsoft Windows [Version 10.0.15063]

Before the `git version 2.13`, everything was perfect around here, but now with this version they broke my workflow:

Push: process for submodule 'Packages/Advanced CSV' failed
D:\SublimeText\Data> git.exe push --porcelain --progress --tags --recurse-submodules=on-demand origin refs/heads/develop:refs/heads/develop
src refspec 'refs/heads/develop' must name a ref
process for submodule 'Packages/Advanced CSV' failed


quote:
It looks like the git push recurse-submodules behavior has changed.
Currently with 2.13 you cannot run "git push
--recurse-submodules=on-demand" if the parent repo is on a different
branch than the sub repos, e.g. parent repo is on "develop" and
sub-repo on "master".
...
I was under the impression that Jonathan and may be others considered
the fact that `git push --recurse-submodules=on-demand` doesn't work
as before an unintentional change. He asked me previously if pushing
without a refspec will work for us and I responded with a yes. The
question remains if everyone is on board with change push without
refspec to use `push.default` in the parent repo as well as
submodules.

Cheers,
JS

git push recurse.submodules behavior changed in 2.13 https://public-inbox.org/git/CAE5=+KX57KM+6n9NpePw9KYPXFy7UH-WRgSwaJDnvRofYFXm7Q@mail.gmail.com/T/

I did not understand the last part `without refspec to use push.default in the parent repo as well
as submodules`, is it a way to `git push --recurse-submodules=on-demand` when the parent repo is on
the `develop` branch and the submodules are on the `master` branch?

If it is not, how can I do `git push --recurse-submodules=on-demand` when the parent repo is on the
`develop` branch, but the submodules are on the `master` branch with this new git version?



What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example http://stackoverflow.com/help/mcve
this will help us understand the issue.

1. You need create a main repository
2. Add a git submodule to it and checkout on the master branch
3. Go to your main repository and add the master branch.
4. Go to the submodule and commit some changes on its master branch, but do not push them.
5. Go to the main repository and commit the submodule head pointer change.
6. Go to the main repository and run the command `git.exe push --recurse-submodules=on-demand`

This shell script creates some repositories and remotes which reproduce the problem:


# Create the directory structure
rm -r -f main_repo
rm -r -f main_repo_remote
rm -r -f submodule_remote

mkdir main_repo_remote
mkdir submodule_remote
mkdir main_repo
mkdir main_repo/first_submodule

cd main_repo

# Setup the first_submodule
cd first_submodule
printf "# Submodule Repository\n\n" > README.md
git init
git add README.md
git commit -m "Added the repository first commit."

git init --bare ../../submodule_remote
git remote add origin ../../submodule_remote
git push origin master

# Setup the main_repo
cd ..
printf "# Main Repo\n\nThis is the main repository which contains submodules\n" > README.md
git init
git add README.md
git submodule add -- https://github.com/user/first_submodule "first_submodule"
git commit -m "Added the main repository first commit."

git init --bare ../main_repo_remote
git remote add origin ../main_repo_remote
git push origin master
git checkout -b develop
git push origin develop

# Add an unpushed commit to the submodule
cd first_submodule
printf "Dirty\n\n" >> README.md
git add README.md
git commit -m "Added the repository second commit."

# Go to the main repository and do the push
cd ..
git add first_submodule
git commit -m "Added the main repository second commit."
git push --recurse-submodules=on-demand --set-upstream origin develop


At its last line, I am doing the push on the main repo, but it is failing on the new git version.
Currently the solution is to open the submodules which need to be pushed and push them before to
push the main repository. The problem is that the `--recurse-submodules=on-demand` should work, but
it is not.


What did you expect to occur after running these commands?
I expect to the main repository and the submodule to be pushed to the its remote branch.


What actually happened instead?
After git version `2.13` I see the error `src refspec 'refs/heads/develop' must name a ref`

If the problem was occurring with a specific repository, can you provide the URL to that repository
to help us with testing?

This issue happens mostly with my repository on its develop branch:

https://github.com/evandrocoan/SublimeTextStudio

Which has about 73 git submodules, checkout on the master branch, while the main repository is
checkout on the develop branch.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-27 16:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 16:23 "git push --recurse-submodules=on-demand" regression Jonathan Nieder

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).