{"action":"created","issue":{"url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/69","labels_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/69/comments","events_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/69/events","html_url":"https://github.com/ingydotnet/git-subrepo/issues/69","id":60128395,"number":69,"title":"Various problems with push","user":{"login":"jrosdahl","id":146927,"avatar_url":"https://avatars.githubusercontent.com/u/146927?v=3","gravatar_id":"","url":"https://api.github.com/users/jrosdahl","html_url":"https://github.com/jrosdahl","followers_url":"https://api.github.com/users/jrosdahl/followers","following_url":"https://api.github.com/users/jrosdahl/following{/other_user}","gists_url":"https://api.github.com/users/jrosdahl/gists{/gist_id}","starred_url":"https://api.github.com/users/jrosdahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrosdahl/subscriptions","organizations_url":"https://api.github.com/users/jrosdahl/orgs","repos_url":"https://api.github.com/users/jrosdahl/repos","events_url":"https://api.github.com/users/jrosdahl/events{/privacy}","received_events_url":"https://api.github.com/users/jrosdahl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-06T16:57:46Z","updated_at":"2015-03-10T01:24:10Z","closed_at":null,"body":"From documentation I get the impression that it should work to run `git subrepo push <subdir>` without specifying a subrepo branch, but I can't get it to work.\r\n\r\nTo reproduce what I'm trying to do, change\r\n\r\n    git subrepo push bar subrepo/bar\r\n\r\nto\r\n\r\n    git subrepo push bar\r\n\r\nin `test/subrepo-push.t`. The test case then fails like this:\r\n\r\n```\r\ntest/subrepo-push.t .. 1/? #   Failed test 'push message is correct'\r\n#   at test/subrepo-push.t line 45.\r\n#     got: 'Subrepo 'bar' has no new commits to push.'\r\n#   expected: 'Subrepo 'bar' pushed to '../../../tmp/upstream/bar' (master).'\r\ntest/subrepo-push.t .. 2/? #   Failed test 'File 'tmp/owner/bar/FooBar' exists'\r\n#   at test/setup line 81.\r\ntest/subrepo-push.t .. Failed 2/6 subtests \r\n```\r\n\r\nI guess it's supposed to work? If not, perhaps documentation could be improved?\r\n\r\nDon't know if it's related, but another bug, I think, is that it doesn't work to push immediately after clone. This can be reproduced by removing the\r\n\r\n```\r\n(\r\n  cd $OWNER/bar\r\n  add-new-files bargy\r\n  git push\r\n)\r\n```\r\n\r\npart of `test/subrepo-push.t`. The test case then fails with\r\n\r\n```\r\ntest/subrepo-push.t .. git-subrepo: 'subrepo/bar' is not a valid commit.\r\ntest/subrepo-push.t .. No subtests run \r\n```\r\n\r\ninstead of the expected\r\n\r\n```\r\ntest/subrepo-push.t .. 1/? #   Failed test 'File 'tmp/owner/bar/bargy' exists'\r\n```\r\n\r\nI tried to make my own little standalone testcase, but it unfortunately only made me more confused. Here it is:\r\n\r\n```\r\ngit init subproject\r\n(\r\n    cd subproject\r\n\r\n    echo foo >foo\r\n    git add foo\r\n    git commit -m foo\r\n)\r\n\r\ngit init superproject\r\n(\r\n    cd superproject\r\n\r\n    # echo bar >bar\r\n    # git add bar\r\n    # git commit -m bar\r\n\r\n    git subrepo clone ../subproject\r\n    echo foo >>subproject/foo\r\n    git commit -am foo\r\n\r\n    git subrepo push subproject\r\n)\r\n```\r\n\r\nThe last command fails like this:\r\n\r\n```\r\nfatal: ambiguous argument 'none..HEAD': unknown revision or path not in the working tree.\r\nUse '--' to separate paths from revisions, like this:\r\n'git <command> [<revision>...] -- [<file>...]'\r\nSubrepo 'subproject' has no new commits to push.\r\n```\r\n\r\nWhen uncommenting the three commented lines, the failure is\r\n\r\n```\r\nThe 'git rebase' command failed during your push.\r\nYou will need to finish the push by hand. Follow these steps:\r\n\r\n  # Resolve the rebase conflicts\r\n  git checkout master\r\n  git subrepo push subproject subrepo-push/subproject\r\n\r\nTo abort the push and reset back to where you started:\r\n\r\n  git rebase --abort\r\n  git checkout ORIG_HEAD\r\n  git subrepo clean subproject\r\n\r\nSee 'git help subrepo' for more help.\r\n```\r\n\r\nbut unless I'm missing something, there should be no conflicts.\r\n\r\nI'm using Git version 2.1.0 and git-subrepo 5c38bbc8b48ef73d5a56f603b77436be79a5ed12."},"comment":{"url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/comments/77979125","html_url":"https://github.com/ingydotnet/git-subrepo/issues/69#issuecomment-77979125","issue_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/69","id":77979125,"user":{"login":"AndrewSmart","id":5455129,"avatar_url":"https://avatars.githubusercontent.com/u/5455129?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewSmart","html_url":"https://github.com/AndrewSmart","followers_url":"https://api.github.com/users/AndrewSmart/followers","following_url":"https://api.github.com/users/AndrewSmart/following{/other_user}","gists_url":"https://api.github.com/users/AndrewSmart/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewSmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewSmart/subscriptions","organizations_url":"https://api.github.com/users/AndrewSmart/orgs","repos_url":"https://api.github.com/users/AndrewSmart/repos","events_url":"https://api.github.com/users/AndrewSmart/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewSmart/received_events","type":"User","site_admin":false},"created_at":"2015-03-10T01:24:10Z","updated_at":"2015-03-10T01:24:10Z","body":"Ok, my earlier guess was wrong:\r\n> ```<bash>\r\nmessage=\"$(\r\n    cd $OWNER/foo\r\n    git subrepo pull --quiet bar #Nothing will be pulled since you'd removed bargy\r\n    git subrepo branch bar --quiet #Creates subrepo/bar with the commits meant to be pushed\r\n    git subrepo push bar subrepo/bar\r\n  )\"```\r\n\r\nI need to look into this a bit more.\r\n\r\n> I think it helps to know in the current design, subrepo push is more simple than it could be (it expects the subrepo to be ready to pushed). I think Ingy wrote about that somewhere, but I don't see it in the current documentation.\r\n\r\nOk, I was wrong here too. There are two meanings to the `git subrepo push <subdir> [<branch>]` command, depending on the presence of that optional branch argument.  This distinction is in the documentation.\r\n\r\nA side effect of the `git subrepo pull --quiet bar` command is that the `subrepo/bar` branch is left when there was something to pull; but when there was nothing to pull the branch isn't created.  So dropping the branch name in `git subrepo push bar subrepo/bar`, will result in it creating a temporary branch during it's work, instead of trying to use what you specify. Sorry I was misled here.\r\n\r\nI suppose things could be improved here, so that the commands don't have to be changed contingent on if or if not the pull was able to pull anything new."}}