{"thread":{"id":"46270","subject":"\"git push --recurse-submodules=on-demand\" regression","startedAt":"2017-06-27T16:23:16Z","lastAt":"2017-06-27T16:23:16Z","messageCount":1,"participants":["Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"323343","messageId":"20170627162307.GE161648@aiede.mtv.corp.google.com","threadId":"46270","inReplyTo":null,"subject":"\"git push --recurse-submodules=on-demand\" regression","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-27T16:23:07Z","receivedAt":"2017-06-27T16:23:16Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: evandrocoan <evandrocoan@hotmail.com>\n\nOriginally posted on:\n\nhttps://github.com/git-for-windows/git/issues/1212\n\nMy git version is:\ngit --version --build-options\n\ngit version 2.13.0.windows.1\nbuilt from commit: eba7af3dbb4c846c6303c5f64102acee696c9ab0\nsizeof-long: 4\nmachine: x86\n\ncmd.exe /c ver\nMicrosoft Windows [Version 10.0.15063]\n\nBefore the `git version 2.13`, everything was perfect around here, but now with this version they broke my workflow:\n\nPush: process for submodule 'Packages/Advanced CSV' failed\nD:\\SublimeText\\Data> git.exe push --porcelain --progress --tags --recurse-submodules=on-demand origin refs/heads/develop:refs/heads/develop\nsrc refspec 'refs/heads/develop' must name a ref\nprocess for submodule 'Packages/Advanced CSV' failed\n\n\nquote:\nIt looks like the git push recurse-submodules behavior has changed.\nCurrently with 2.13 you cannot run \"git push\n--recurse-submodules=on-demand\" if the parent repo is on a different\nbranch than the sub repos, e.g. parent repo is on \"develop\" and\nsub-repo on \"master\".\n...\nI was under the impression that Jonathan and may be others considered\nthe fact that `git push --recurse-submodules=on-demand` doesn't work\nas before an unintentional change. He asked me previously if pushing\nwithout a refspec will work for us and I responded with a yes. The\nquestion remains if everyone is on board with change push without\nrefspec to use `push.default` in the parent repo as well as\nsubmodules.\n\nCheers,\nJS\n\ngit push recurse.submodules behavior changed in 2.13 https://public-inbox.org/git/CAE5=+KX57KM+6n9NpePw9KYPXFy7UH-WRgSwaJDnvRofYFXm7Q@mail.gmail.com/T/\n\nI did not understand the last part `without refspec to use push.default in the parent repo as well\nas submodules`, is it a way to `git push --recurse-submodules=on-demand` when the parent repo is on\nthe `develop` branch and the submodules are on the `master` branch?\n\nIf it is not, how can I do `git push --recurse-submodules=on-demand` when the parent repo is on the\n`develop` branch, but the submodules are on the `master` branch with this new git version?\n\n\n\nWhat commands did you run to trigger this issue? If you can provide a\nMinimal, Complete, and Verifiable example http://stackoverflow.com/help/mcve\nthis will help us understand the issue.\n\n1. You need create a main repository\n2. Add a git submodule to it and checkout on the master branch\n3. Go to your main repository and add the master branch.\n4. Go to the submodule and commit some changes on its master branch, but do not push them.\n5. Go to the main repository and commit the submodule head pointer change.\n6. Go to the main repository and run the command `git.exe push --recurse-submodules=on-demand`\n\nThis shell script creates some repositories and remotes which reproduce the problem:\n\n\n# Create the directory structure\nrm -r -f main_repo\nrm -r -f main_repo_remote\nrm -r -f submodule_remote\n\nmkdir main_repo_remote\nmkdir submodule_remote\nmkdir main_repo\nmkdir main_repo/first_submodule\n\ncd main_repo\n\n# Setup the first_submodule\ncd first_submodule\nprintf \"# Submodule Repository\\n\\n\" > README.md\ngit init\ngit add README.md\ngit commit -m \"Added the repository first commit.\"\n\ngit init --bare ../../submodule_remote\ngit remote add origin ../../submodule_remote\ngit push origin master\n\n# Setup the main_repo\ncd ..\nprintf \"# Main Repo\\n\\nThis is the main repository which contains submodules\\n\" > README.md\ngit init\ngit add README.md\ngit submodule add -- https://github.com/user/first_submodule \"first_submodule\"\ngit commit -m \"Added the main repository first commit.\"\n\ngit init --bare ../main_repo_remote\ngit remote add origin ../main_repo_remote\ngit push origin master\ngit checkout -b develop\ngit push origin develop\n\n# Add an unpushed commit to the submodule\ncd first_submodule\nprintf \"Dirty\\n\\n\" >> README.md\ngit add README.md\ngit commit -m \"Added the repository second commit.\"\n\n# Go to the main repository and do the push\ncd ..\ngit add first_submodule\ngit commit -m \"Added the main repository second commit.\"\ngit push --recurse-submodules=on-demand --set-upstream origin develop\n\n\nAt its last line, I am doing the push on the main repo, but it is failing on the new git version.\nCurrently the solution is to open the submodules which need to be pushed and push them before to\npush the main repository. The problem is that the `--recurse-submodules=on-demand` should work, but\nit is not.\n\n\nWhat did you expect to occur after running these commands?\nI expect to the main repository and the submodule to be pushed to the its remote branch.\n\n\nWhat actually happened instead?\nAfter git version `2.13` I see the error `src refspec 'refs/heads/develop' must name a ref`\n\nIf the problem was occurring with a specific repository, can you provide the URL to that repository\nto help us with testing?\n\nThis issue happens mostly with my repository on its develop branch:\n\nhttps://github.com/evandrocoan/SublimeTextStudio\n\nWhich has about 73 git submodules, checkout on the master branch, while the main repository is\ncheckout on the develop branch.\n"}]}