{"thread":{"id":"27815","subject":"git push vs. slow connection times - local commit resolution is too late","startedAt":"2011-07-14T13:22:50Z","lastAt":"2011-07-17T19:46:28Z","messageCount":4,"participants":["Eric Blake","Phil Hord","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171335","messageId":"4E1EEDAA.1000204@redhat.com","threadId":"27815","inReplyTo":null,"subject":"git push vs. slow connection times - local commit resolution is too late","fromName":"Eric Blake","fromEmail":"eblake@redhat.com","sentAt":"2011-07-14T13:22:50Z","receivedAt":"2011-07-14T13:22:50Z","isPatch":false,"sender":{"key":"eblake@redhat.com","avatar":"https://avatars.githubusercontent.com/u/32933908?v=4"},"body":"I've been bitten several times by this bug now, so I'll report it in the\nhopes that someone knows what to do to patch it.\n\nScenario - I have a remote repository that takes on the order of 10\nseconds to connect to, for any operation like 'git push'.  I know that\nthere is a lag, so I intentionally have two terminals open, both\nvisiting the same directory, one for interaction with the remote, and\nthe other for acting on the local repository, with the hope that I can\ndo useful work in the second terminal rather than idly waiting on the\nlag in the first terminal.\n\nIn the middle of rebasing a patch series, where I want to incrementally\npush the patches that I have gotten through so far, I used the following\nsteps:\n\nOn the remote-interaction terminal, I push the current state of my tree:\ngit push remote HEAD:master\n\nOn the local-interaction terminal, I move on to the next patch:\ngit rebase --continue\n\nthen, to my horror, I find out that the commit I'm working on locally\nhas already been pushed!  Why?  Because 'git push remote HEAD:master'\ndoes not determine which commit 'HEAD' refers to until _after_ it has\nestablished a connection to remote, but the stupid 10-second lag was\nlong enough that my actions in my second terminal have changed HEAD in\nthe meantime.\n\nI would really love it if 'git push' would resolve all local references\n_prior_ to trying to connect to the remote server, rather than waiting\nuntil after the connection.  That way, my remote-interaction terminal\ncan truly be a type-it-and-forget-it terminal, where the push action I\nrequested reflects the state of the tree at the time I requested it,\nrather than picking up changes made later in another terminal.\n\n-- \nEric Blake   eblake@redhat.com    +1-801-349-2682\nLibvirt virtualization library http://libvirt.org\n\n"},{"id":"171455","messageId":"4E2115D5.4010002@cisco.com","threadId":"27815","inReplyTo":"4E1EEDAA.1000204@redhat.com","subject":"Re: git push vs. slow connection times - local commit resolution is too late","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2011-07-16T04:38:45Z","receivedAt":"2011-07-16T04:38:45Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"\nOn 07/14/2011 09:22 AM, Eric Blake wrote:\n> I've been bitten several times by this bug now, so I'll report it in the\n> hopes that someone knows what to do to patch it.\n>\n> Scenario - I have a remote repository that takes on the order of 10\n> seconds to connect to, for any operation like 'git push'.  I know that\n> there is a lag, so I intentionally have two terminals open, both\n> visiting the same directory, one for interaction with the remote, and\n> the other for acting on the local repository, with the hope that I can\n> do useful work in the second terminal rather than idly waiting on the\n> lag in the first terminal.\n>\n> In the middle of rebasing a patch series, where I want to incrementally\n> push the patches that I have gotten through so far, I used the following\n> steps:\n>\n> On the remote-interaction terminal, I push the current state of my tree:\n> git push remote HEAD:master\n>\n> On the local-interaction terminal, I move on to the next patch:\n> git rebase --continue\n>\n> then, to my horror, I find out that the commit I'm working on locally\n> has already been pushed!  Why?  Because 'git push remote HEAD:master'\n> does not determine which commit 'HEAD' refers to until _after_ it has\n> established a connection to remote, but the stupid 10-second lag was\n> long enough that my actions in my second terminal have changed HEAD in\n> the meantime.\n>\n> I would really love it if 'git push' would resolve all local references\n> _prior_ to trying to connect to the remote server, rather than waiting\n> until after the connection.  That way, my remote-interaction terminal\n> can truly be a type-it-and-forget-it terminal, where the push action I\n> requested reflects the state of the tree at the time I requested it,\n> rather than picking up changes made later in another terminal.\n\nI agree with your suggestion.  But as a quick fix, can you do this?\n   git push remote $(cat .git/HEAD):master\n\nDamned inconvenient, though.\n\nPhil\n"},{"id":"171459","messageId":"m2oc0uz8uh.fsf@igel.home","threadId":"27815","inReplyTo":"4E2115D5.4010002@cisco.com","subject":"Re: git push vs. slow connection times - local commit resolution is too late","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-07-16T12:52:06Z","receivedAt":"2011-07-16T12:52:06Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Phil Hord <hordp@cisco.com> writes:\n\n> I agree with your suggestion.  But as a quick fix, can you do this?\n>   git push remote $(cat .git/HEAD):master\n\nYou mean $(git rev-parse HEAD), don't you?\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"171520","messageId":"4E233C14.6080309@cisco.com","threadId":"27815","inReplyTo":"m2oc0uz8uh.fsf@igel.home","subject":"Re: git push vs. slow connection times - local commit resolution is too late","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2011-07-17T19:46:28Z","receivedAt":"2011-07-17T19:46:28Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"Andreas Schwab helpfully chimed in\n > Phil Hord <hordp@cisco.com> writes:\n >\n > > I agree with your suggestion.  But as a quick fix, can you do this?\n > >   git push remote $(cat .git/HEAD):master\n >\n > You mean $(git rev-parse HEAD), don't you?\n\nYes, I do. :-) But I don't use it enough to remember it, and the man \npages are not cross-referenced well enough for me.  So I shrugged.\n\nThanks for helping me out.\n\nPhil\n"}]}