{"thread":{"id":"33672","subject":"Unexpected behavior of git-subtree","startedAt":"2013-04-29T17:34:27Z","lastAt":"2013-04-30T11:13:54Z","messageCount":3,"participants":["Steffen Jaeckel","John Keeping"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"215874","messageId":"1003348467.20130429193427@stzedn.de","threadId":"33672","inReplyTo":null,"subject":"Unexpected behavior of git-subtree","fromName":"Steffen Jaeckel","fromEmail":"steffen.jaeckel@stzedn.de","sentAt":"2013-04-29T17:34:27Z","receivedAt":"2013-04-29T17:34:27Z","isPatch":false,"sender":{"key":"steffen.jaeckel@stzedn.de","avatar":"https://gravatar.com/avatar/12d8a352f2825a89f36bd8d4a5742311b23d75a446c096949afa4a9f16274bf4?d=mp&s=160"},"body":"Hi,\n\nlately I used git-subtree to integrate a submodule directly into a\nrepository. Now I wanted to push the changes back to the original\nrepository of the submodule and I was a bit surprised by what\nhappened...\n\n\n---- snip ----\nsjaeckel@T7400-003 /h/projects/my_project (develop)\n$ GIT_TRACE=2 git subtree push --prefix=lib/com_lib/ git@git.local:com_lib develop -b develop\ntrace: exec: 'git-subtree' 'push' '--prefix=lib/com_lib/' 'git@git.local:com_lib' 'develop' '-b' 'develop'\ntrace: run_command: 'git-subtree' 'push' '--prefix=lib/com_lib/' 'git@git.local:com_lib' 'develop' '-b' 'develop'\ntrace: built-in: git 'rev-parse' '--parseopt' '--' 'push' '--prefix=lib/com_lib/' 'git@git.local:com_lib' 'develop' '-b' 'develop'\ntrace: built-in: git 'rev-parse' '--git-dir'\ntrace: built-in: git 'rev-parse' '--show-cdup'\ngit push using:  git@git.local:com_lib develop\ntrace: exec: 'git-subtree' 'split' '--prefix=lib/com_lib/'\ntrace: run_command: 'git-subtree' 'split' '--prefix=lib/com_lib/'\ntrace: built-in: git 'rev-parse' '--parseopt' '--' 'split' '--prefix=lib/com_lib/'\ntrace: built-in: git 'rev-parse' '--git-dir'\ntrace: built-in: git 'rev-parse' '--show-cdup'\ntrace: built-in: git 'rev-parse' '--default' 'HEAD' '--revs-only'\ntrace: built-in: git 'rev-parse' '--no-revs' '--no-flags'\ntrace: built-in: git 'log' '--grep=^git-subtree-dir: lib/com_lib/*$' '--pretty=format:START %H%n%s%n%n%b%nEND%n' '8068a810709f6284b04a18ff38dbb72c36b8d9c6'\ntrace: built-in: git 'rev-list' '--topo-order' '--reverse' '--parents' '8068a810709f6284b04a18ff38dbb72c36b8d9c6'\ntrace: built-in: git 'rev-list' '--topo-order' '--reverse' '--parents' '8068a810709f6284b04a18ff38dbb72c36b8d9c6'\n1/    102 (0)trace: built-in: git 'ls-tree' 'f6e1457d345029cf4d376ff3cf780cbb8c3080b4' '--' 'lib/com_lib'\n..... loads of more git 'ls-tree'...\n71/    102 (70)72/    102 (70)trace: built-in: git 'ls-tree' '48dc0efb9a148b1146b013554f8bf4635adf7a0d' '--' 'lib/com_lib'\ntrace: built-in: git 'log' '-1' '--pretty=format:%T' '6299b48765e11302aca48cc9fca88735aeab7c54' '--'\nfatal: bad object 6299b48765e11302aca48cc9fca88735aeab7c54\ntrace: built-in: git 'push' 'git@git.local:com_lib' ':refs/heads/develop'\ntrace: run_command: 'ssh' 'git@git.local' 'git-receive-pack '\\''com_lib'\\'''\nRepository name is: com_lib.git\nRepository_Clean name is: com_lib\nBranch name is: com_lib/develop\nTo git@git.local:com_lib\n - [deleted]         develop\nsjaeckel@T7400-003 /h/projects/my_project (develop)\n$ git version\ngit version 1.8.1.msysgit.1\n---- /snip ----\n\n\nI don't know if that's a bug or I used git-subtree's options incorrect,\nbut what I read from its \"manpage\" 'git-subtree.txt', I would expect\nthat this command should split out the commits of the prefix and push\nthat to the remote of the former submodule.\n\nEven if it's my fault, because I used it incorrect, I think it should\nnot delete the remote branch.\n\nBesides \"git subtree push --prefix=lib/com_lib/ git@git.local:com_lib\ndevelop -b develop\" I also tried \"git subtree push\n--prefix=lib/com_lib/ git@git.local:com_lib develop\" with the same\neffect.\n\nCan someone tell me if that's a bug, and/or what I did wrong?\n\n\nThanks\nSteffen\n"},{"id":"215894","messageId":"20130429182052.GN472@serenity.lan","threadId":"33672","inReplyTo":"1003348467.20130429193427@stzedn.de","subject":"Re: Unexpected behavior of git-subtree","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-04-29T18:20:52Z","receivedAt":"2013-04-29T18:20:52Z","isPatch":false,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Mon, Apr 29, 2013 at 07:34:27PM +0200, Steffen Jaeckel wrote:\n> lately I used git-subtree to integrate a submodule directly into a\n> repository. Now I wanted to push the changes back to the original\n> repository of the submodule and I was a bit surprised by what\n> happened...\n> \n> \n> ---- snip ----\n> sjaeckel@T7400-003 /h/projects/my_project (develop)\n> $ GIT_TRACE=2 git subtree push --prefix=lib/com_lib/ git@git.local:com_lib develop -b develop\n> trace: exec: 'git-subtree' 'push' '--prefix=lib/com_lib/' 'git@git.local:com_lib' 'develop' '-b' 'develop'\n> trace: run_command: 'git-subtree' 'push' '--prefix=lib/com_lib/' 'git@git.local:com_lib' 'develop' '-b' 'develop'\n> trace: built-in: git 'rev-parse' '--parseopt' '--' 'push' '--prefix=lib/com_lib/' 'git@git.local:com_lib' 'develop' '-b' 'develop'\n> trace: built-in: git 'rev-parse' '--git-dir'\n> trace: built-in: git 'rev-parse' '--show-cdup'\n> git push using:  git@git.local:com_lib develop\n> trace: exec: 'git-subtree' 'split' '--prefix=lib/com_lib/'\n> trace: run_command: 'git-subtree' 'split' '--prefix=lib/com_lib/'\n> trace: built-in: git 'rev-parse' '--parseopt' '--' 'split' '--prefix=lib/com_lib/'\n> trace: built-in: git 'rev-parse' '--git-dir'\n> trace: built-in: git 'rev-parse' '--show-cdup'\n> trace: built-in: git 'rev-parse' '--default' 'HEAD' '--revs-only'\n> trace: built-in: git 'rev-parse' '--no-revs' '--no-flags'\n> trace: built-in: git 'log' '--grep=^git-subtree-dir: lib/com_lib/*$' '--pretty=format:START %H%n%s%n%n%b%nEND%n' '8068a810709f6284b04a18ff38dbb72c36b8d9c6'\n> trace: built-in: git 'rev-list' '--topo-order' '--reverse' '--parents' '8068a810709f6284b04a18ff38dbb72c36b8d9c6'\n> trace: built-in: git 'rev-list' '--topo-order' '--reverse' '--parents' '8068a810709f6284b04a18ff38dbb72c36b8d9c6'\n> 1/    102 (0)trace: built-in: git 'ls-tree' 'f6e1457d345029cf4d376ff3cf780cbb8c3080b4' '--' 'lib/com_lib'\n> ..... loads of more git 'ls-tree'...\n> 71/    102 (70)72/    102 (70)trace: built-in: git 'ls-tree' '48dc0efb9a148b1146b013554f8bf4635adf7a0d' '--' 'lib/com_lib'\n> trace: built-in: git 'log' '-1' '--pretty=format:%T' '6299b48765e11302aca48cc9fca88735aeab7c54' '--'\n> fatal: bad object 6299b48765e11302aca48cc9fca88735aeab7c54\n\nWithout knowing much about git-subtree, this looks like the culprit.  A\nquick look at cmd_push in git-subtree.sh indicates that it doesn't check\nfor an error return from 'git subtree split --prefix=$prefix', so if\nthat goes wrong you end up doing:\n\n    git push $repository :refs/heads/$refspec\n\nwhich deletes the branch.\n\nCan you try running this:\n\n    git subtree split --prefix=lib/com_lib/\n\nand see if that gives the same \"fatal: bad object\" message as above?\n"},{"id":"215982","messageId":"10210336576.20130430131354@stzedn.de","threadId":"33672","inReplyTo":"20130429182052.GN472@serenity.lan","subject":"Re: Unexpected behavior of git-subtree","fromName":"Steffen Jaeckel","fromEmail":"steffen.jaeckel@stzedn.de","sentAt":"2013-04-30T11:13:54Z","receivedAt":"2013-04-30T11:13:54Z","isPatch":false,"sender":{"key":"steffen.jaeckel@stzedn.de","avatar":"https://gravatar.com/avatar/12d8a352f2825a89f36bd8d4a5742311b23d75a446c096949afa4a9f16274bf4?d=mp&s=160"},"body":"On Monday, April 29, 2013, 20:20, John Keeping, <john@keeping.me.uk> wrote:\n> On Mon, Apr 29, 2013 at 07:34:27PM +0200, Steffen Jaeckel wrote:\n>>\n>> ---- snip ----\n>> sjaeckel@T7400-003 /h/projects/my_project (develop)\n>> $ GIT_TRACE=2 git subtree push --prefix=lib/com_lib/ git@git.local:com_lib develop -b develop\n\n> Without knowing much about git-subtree, this looks like the culprit.  A\n> quick look at cmd_push in git-subtree.sh indicates that it doesn't check\n> for an error return from 'git subtree split --prefix=$prefix', so if\n> that goes wrong you end up doing:\n\n>     git push $repository :refs/heads/$refspec\n\n> which deletes the branch.\n\n> Can you try running this:\n\n>     git subtree split --prefix=lib/com_lib/\n\n> and see if that gives the same \"fatal: bad object\" message as above?\n\nJohn, thanks for testing!\nI just found out that it's all about the slashes....\n\nThe solution was:\n> git subtree push --prefix=lib/com_lib git@git.local:com_lib develop\nlook at the missing '/' at the end of the prefix.\n\n\nSteffen\n-- \nSteffen Jaeckel\n"}]}