{"thread":{"id":"30023","subject":"[BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","startedAt":"2012-03-22T06:04:42Z","lastAt":"2012-03-22T18:45:57Z","messageCount":11,"participants":["Hong Xu","Zbigniew Jędrzejewski-Szmek","Johannes Sixt","Junio C Hamano","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"187447","messageId":"4F6AC0FA.7040708@gmail.com","threadId":"30023","inReplyTo":null,"subject":"[BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Hong Xu","fromEmail":"xuhdev@gmail.com","sentAt":"2012-03-22T06:04:42Z","receivedAt":"2012-03-22T06:04:42Z","isPatch":false,"sender":{"key":"xuhdev@gmail.com","avatar":"https://gravatar.com/avatar/ab8b0c94aee37e4676b68bcff2e2ce0054f7067ab3a1e21b191ab75a873f2b60?d=mp&s=160"},"body":"Hello everyone,\n\nIf my ssh key is encrypted, \"git pull origin mas<tab>\" will give a \nunexpected result, something like this:\n\ngit pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\n\nI know maybe it is not possible to complete the \"master\", but maybe it \nis better to not complete anything than append something like that?\n\nThanks!\n\nHong\n"},{"id":"187455","messageId":"4F6AFEC8.9090907@in.waw.pl","threadId":"30023","inReplyTo":"4F6AC0FA.7040708@gmail.com","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-22T10:28:24Z","receivedAt":"2012-03-22T10:28:24Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 03/22/2012 07:04 AM, Hong Xu wrote:\n> Hello everyone,\n>\n> If my ssh key is encrypted, \"git pull origin mas<tab>\" will give a\n> unexpected result, something like this:\n>\n> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\n>\n> I know maybe it is not possible to complete the \"master\", but maybe it\n> is better to not complete anything than append something like that?\nIt is ssh itself which emits this message. The completion script calls \n'git ls-remote origin', which in turn invokes ssh. Typing the password \nin actually works, but I understand that you are annoyed by the message.\n\nI don't think there's an easy way to silence this in git completion, \nwithout affecting other times when the key would be requested. E.g. we \nwould want ssh to ask for the key while doing 'git pull', but not when \nrun automatically during completion.\n\nMaybe git-ls-remote should learn --quiet?\n\nZbyszek\n"},{"id":"187457","messageId":"4F6B16BE.1050003@viscovery.net","threadId":"30023","inReplyTo":"4F6AFEC8.9090907@in.waw.pl","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-03-22T12:10:38Z","receivedAt":"2012-03-22T12:10:38Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:\n> On 03/22/2012 07:04 AM, Hong Xu wrote:\n>> Hello everyone,\n>>\n>> If my ssh key is encrypted, \"git pull origin mas<tab>\" will give a\n>> unexpected result, something like this:\n>>\n>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\n>>\n>> I know maybe it is not possible to complete the \"master\", but maybe it\n>> is better to not complete anything than append something like that?\n> It is ssh itself which emits this message. The completion script calls\n> 'git ls-remote origin', which in turn invokes ssh. Typing the password in\n> actually works, but I understand that you are annoyed by the message.\n> \n> I don't think there's an easy way to silence this in git completion,\n> without affecting other times when the key would be requested. E.g. we\n> would want ssh to ask for the key while doing 'git pull', but not when run\n> automatically during completion.\n> \n> Maybe git-ls-remote should learn --quiet?\n\nNo. IMHO, bash completion stretches too far by asking the remote for the\nrefs that it has.\n\n-- Hannes\n"},{"id":"187462","messageId":"03324BD2-116A-42EF-AB18-38F4A30A1115@gmail.com","threadId":"30023","inReplyTo":"4F6B16BE.1050003@viscovery.net","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Hong Xu","fromEmail":"xuhdev@gmail.com","sentAt":"2012-03-22T12:48:56Z","receivedAt":"2012-03-22T12:48:56Z","isPatch":false,"sender":{"key":"xuhdev@gmail.com","avatar":"https://gravatar.com/avatar/ab8b0c94aee37e4676b68bcff2e2ce0054f7067ab3a1e21b191ab75a873f2b60?d=mp&s=160"},"body":"\n\nOn Mar 22, 2012, at 20:10, Johannes Sixt <j.sixt@viscovery.net> wrote:\n\n> Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:\n>> On 03/22/2012 07:04 AM, Hong Xu wrote:\n>>> Hello everyone,\n>>> \n>>> If my ssh key is encrypted, \"git pull origin mas<tab>\" will give a\n>>> unexpected result, something like this:\n>>> \n>>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\n>>> \n>>> I know maybe it is not possible to complete the \"master\", but maybe it\n>>> is better to not complete anything than append something like that?\n>> It is ssh itself which emits this message. The completion script calls\n>> 'git ls-remote origin', which in turn invokes ssh. Typing the password in\n>> actually works, but I understand that you are annoyed by the message.\n>> \n>> I don't think there's an easy way to silence this in git completion,\n>> without affecting other times when the key would be requested. E.g. we\n>> would want ssh to ask for the key while doing 'git pull', but not when run\n>> automatically during completion.\n>> \n>> Maybe git-ls-remote should learn --quiet?\n> \n> No. IMHO, bash completion stretches too far by asking the remote for the\n> refs that it has.\n> \n\nI agree with this rather than using silent mode. If a encrypted key is found, I think we better drop the completion. I don't know whether there is a way to implement this yet, at least we can try to find it.\n\nHong"},{"id":"187463","messageId":"4F6B2146.8060408@in.waw.pl","threadId":"30023","inReplyTo":"03324BD2-116A-42EF-AB18-38F4A30A1115@gmail.com","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-22T12:55:34Z","receivedAt":"2012-03-22T12:55:34Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 03/22/2012 01:48 PM, Hong Xu wrote:\n>\n>\n> On Mar 22, 2012, at 20:10, Johannes Sixt<j.sixt@viscovery.net>  wrote:\n>\n>> Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:\n>>> On 03/22/2012 07:04 AM, Hong Xu wrote:\n>>>> Hello everyone,\n>>>>\n>>>> If my ssh key is encrypted, \"git pull origin mas<tab>\" will give a\n>>>> unexpected result, something like this:\n>>>>\n>>>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\n>>>>\n>>>> I know maybe it is not possible to complete the \"master\", but maybe it\n>>>> is better to not complete anything than append something like that?\n>>> It is ssh itself which emits this message. The completion script calls\n>>> 'git ls-remote origin', which in turn invokes ssh. Typing the password in\n>>> actually works, but I understand that you are annoyed by the message.\n>>>\n>>> I don't think there's an easy way to silence this in git completion,\n>>> without affecting other times when the key would be requested. E.g. we\n>>> would want ssh to ask for the key while doing 'git pull', but not when run\n>>> automatically during completion.\n>>>\n>>> Maybe git-ls-remote should learn --quiet?\n>>\n>> No. IMHO, bash completion stretches too far by asking the remote for the\n>> refs that it has.\n>>\n>\n> I agree with this rather than using silent mode. If a encrypted key is found, I think we better drop the completion. I don't know whether there is a way to implement this yet, at least we can try to find it.\nThere's more than one reason why ssh would ask for a password. So just\nchecking for an encrypted key is pointless. Instead, ssh could be \ninvoked with -o BatchMode=yes. ls-remote could pass this option if it \nwas invoked with --quiet.\n\nPossible this is just not worth the trouble and Hong should enter the \nrun ssh-agent and enter the password beforehand.\n\nZbyszek\n"},{"id":"187464","messageId":"4F6B2284.5030508@gmail.com","threadId":"30023","inReplyTo":"4F6B2146.8060408@in.waw.pl","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Hong Xu","fromEmail":"xuhdev@gmail.com","sentAt":"2012-03-22T13:00:52Z","receivedAt":"2012-03-22T13:00:52Z","isPatch":false,"sender":{"key":"xuhdev@gmail.com","avatar":"https://gravatar.com/avatar/ab8b0c94aee37e4676b68bcff2e2ce0054f7067ab3a1e21b191ab75a873f2b60?d=mp&s=160"},"body":"On 03/22/2012 08:55 PM, Zbigniew Jędrzejewski-Szmek wrote:\n> On 03/22/2012 01:48 PM, Hong Xu wrote:\n>>\n>>\n>> On Mar 22, 2012, at 20:10, Johannes Sixt<j.sixt@viscovery.net> wrote:\n>>\n>>> Am 3/22/2012 11:28, schrieb Zbigniew Jędrzejewski-Szmek:\n>>>> On 03/22/2012 07:04 AM, Hong Xu wrote:\n>>>>> Hello everyone,\n>>>>>\n>>>>> If my ssh key is encrypted, \"git pull origin mas<tab>\" will give a\n>>>>> unexpected result, something like this:\n>>>>>\n>>>>> git pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\n>>>>>\n>>>>> I know maybe it is not possible to complete the \"master\", but maybe it\n>>>>> is better to not complete anything than append something like that?\n>>>> It is ssh itself which emits this message. The completion script calls\n>>>> 'git ls-remote origin', which in turn invokes ssh. Typing the\n>>>> password in\n>>>> actually works, but I understand that you are annoyed by the message.\n>>>>\n>>>> I don't think there's an easy way to silence this in git completion,\n>>>> without affecting other times when the key would be requested. E.g. we\n>>>> would want ssh to ask for the key while doing 'git pull', but not\n>>>> when run\n>>>> automatically during completion.\n>>>>\n>>>> Maybe git-ls-remote should learn --quiet?\n>>>\n>>> No. IMHO, bash completion stretches too far by asking the remote for the\n>>> refs that it has.\n>>>\n>>\n>> I agree with this rather than using silent mode. If a encrypted key is\n>> found, I think we better drop the completion. I don't know whether\n>> there is a way to implement this yet, at least we can try to find it.\n> There's more than one reason why ssh would ask for a password. So just\n> checking for an encrypted key is pointless. Instead, ssh could be\n> invoked with -o BatchMode=yes. ls-remote could pass this option if it\n> was invoked with --quiet.\n\nThis is a good idea.\n\n>\n> Possible this is just not worth the trouble and Hong should enter the\n> run ssh-agent and enter the password beforehand.\n\nIf I entered the password, it would be like this:\n\ngit pull origin masEnter passphrase for key '/home/user/.ssh/id_rsa':\nter\n\nThen I press Enter, the command runs as it should be. The only problem \nis that this is a bit annoying.\n\nHong\n"},{"id":"187481","messageId":"7vmx78y1eq.fsf@alter.siamese.dyndns.org","threadId":"30023","inReplyTo":"4F6AFEC8.9090907@in.waw.pl","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-22T17:46:05Z","receivedAt":"2012-03-22T17:46:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n\n> Maybe git-ls-remote should learn --quiet?\n\nI would rather think that the completion should ask for refs only when\ndealing with local repositories, without going over network, whether the\nquery involves authentication or not.\n\nWhen given a repository nickname, do we have a good way for the completion\nscript to tell if it is local or remote?  \"type -d $it\" might be cheap way\nto do so, or we could even do \"test $it = .\" to limit it really to the\ncurrent repository.\n"},{"id":"187482","messageId":"vpqvclwo70a.fsf@bauges.imag.fr","threadId":"30023","inReplyTo":"7vmx78y1eq.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-03-22T17:55:17Z","receivedAt":"2012-03-22T17:55:17Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n>\n>> Maybe git-ls-remote should learn --quiet?\n>\n> I would rather think that the completion should ask for refs only when\n> dealing with local repositories, without going over network, whether the\n> query involves authentication or not.\n\nIt depends on what \"network\" is. When the network is just a machine on\nthe same Gb-ethernet LAN, completion can still be useful (only if you\nhave password-less authentication of course). I don't use it much with\nGit, but I find it handy that ZSH completes rsync remote pathes for\nexample.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"187483","messageId":"88F32C4E-F5A9-4741-8707-641F63E41E42@gmail.com","threadId":"30023","inReplyTo":"7vmx78y1eq.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Hong Xu","fromEmail":"xuhdev@gmail.com","sentAt":"2012-03-22T17:56:31Z","receivedAt":"2012-03-22T17:56:31Z","isPatch":false,"sender":{"key":"xuhdev@gmail.com","avatar":"https://gravatar.com/avatar/ab8b0c94aee37e4676b68bcff2e2ce0054f7067ab3a1e21b191ab75a873f2b60?d=mp&s=160"},"body":"\n\nOn Mar 23, 2012, at 1:46, Junio C Hamano <gitster@pobox.com> wrote:\n\n> Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n> \n>> Maybe git-ls-remote should learn --quiet?\n> \n> I would rather think that the completion should ask for refs only when\n> dealing with local repositories, without going over network, whether the\n> query involves authentication or not.\n> \n\nCould you give some reasons about why shouldn't we go through network?\n\nHong"},{"id":"187486","messageId":"4F6B6FAD.6010905@in.waw.pl","threadId":"30023","inReplyTo":"vpqvclwo70a.fsf@bauges.imag.fr","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-22T18:30:05Z","receivedAt":"2012-03-22T18:30:05Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 03/22/2012 06:55 PM, Matthieu Moy wrote:\n> Junio C Hamano<gitster@pobox.com>  writes:\n>\n>> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>>\n>>> Maybe git-ls-remote should learn --quiet?\n>>\n>> I would rather think that the completion should ask for refs only when\n>> dealing with local repositories, without going over network, whether the\n>> query involves authentication or not.\n>\n> It depends on what \"network\" is. When the network is just a machine on\n> the same Gb-ethernet LAN, completion can still be useful (only if you\n> have password-less authentication of course). I don't use it much with\n> Git, but I find it handy that ZSH completes rsync remote pathes for\n> example.\nYeah, I can second that. Even on a slow network, it can be useful. I use \nssh with ControlMaster=yes and completion over a relatively slow network \nis pretty much instantaneous.\n\n-\nZbyszek\n"},{"id":"187491","messageId":"7vehskxymy.fsf@alter.siamese.dyndns.org","threadId":"30023","inReplyTo":"vpqvclwo70a.fsf@bauges.imag.fr","subject":"Re: [BUG] git bash-completion is incorrect for \"git pull origin mas<tab>\" if the ssh key is encrypted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-22T18:45:57Z","receivedAt":"2012-03-22T18:45:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n>> I would rather think that the completion should ask for refs only when\n>> dealing with local repositories, without going over network, whether the\n>> query involves authentication or not.\n>\n> It depends on what \"network\" is. When the network is just a machine on\n> the same Gb-ethernet LAN, completion can still be useful (only if you\n> have password-less authentication of course). I don't use it much with\n> Git, but I find it handy that ZSH completes rsync remote pathes for\n> example.\n\nYeah, I agree it depends on your latency-tolerance (which implies that\nthis begs for an \"I am impatient, do not go over network\" switch).\n"}]}