Originally posted on: 

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


### Setup

 - Which version of Git for Windows are you using? Is it 32-bit or 64-bit?

```
$ git --version --build-options

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

 - Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit 
or 64-bit?

```
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.15063]
```

 - What options did you set as part of the installation? Or did you choose 
the
   defaults?

```
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

$ type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
The system cannot find the path specified.

$ type "C:\Program Files (x86)\Git\etc\install-options.txt"4
The system cannot find the file specified.

$ type "C:\Program Files\Git\etc\install-options.txt"
The system cannot find the path specified.

$ cat /etc/install-options.txt
cat: /etc/install-options.txt: No such file or directory

$ 
```

 - Any other interesting things about your environment that might be related
   to the issue you're seeing?

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

I am using the `Smartgit` client, and now when I hit the push button, I got 
this error above. Searching I found it was a new update on git client the 
problem:

1. [\[smartgit\] Push on demand stopped working on SmartGit 17.0.4][1]

> 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

1. [git push recurse.submodules behavior changed in 2.13][2]
1. [How can I do `git push --recurse-submodules=on-demand` when the parent 
repo is on the `develop` branch with this new git version 
2.13?](https://stackoverflow.com/questions/44641872/how-can-i-do-git-push-recurse-submodules-on-demand-when-the-parent-repo-is-o)

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?


  [1]: 
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/smartgit/xVbPY2Hypro/GutIp9QTBAAJ
  [2]: 
https://public-inbox.org/git/CAE5=+kx57km+6n9npepw9kypxfy7uh-wrgswajdnvrofyfx...@mail.gmail.com/T/

___ 

### Details

 - Which terminal/shell are you running Git from? e.g 
Bash/CMD/PowerShell/other

```
    $ git --version
    git version 2.13.0.windows.1

    $ systeminfo | findstr /B /C:"OS Version"
    OS Version:                10.0.15063 N/A Build 15063

    $ python --version
    Python 3.6.1 :: Anaconda 4.4.0 (32-bit)
```
___

 - 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
1. Add a git submodule to it and checkout on the master branch
1. Go to your main repository and add the master branch.
1. Go to the submodule and commit some changes on its master branch, but do 
not push them.
1. Go to the main repository and commit the submodule head pointer change.
1. 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:
```shell
# 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:

1. https://github.com/evandrocoan/SublimeTextStudio

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


  [1]: https://github.com/wbond/package_control/issues
  [2]: 
https://github.com/wbond/package_control/issues/1233#issuecomment-308921923

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to