{"thread":{"id":"36025","subject":"[PATCH] git-config: document interactive.singlekey requires Term::Readkey","startedAt":"2014-03-02T19:58:40Z","lastAt":"2014-03-03T21:16:12Z","messageCount":4,"participants":["Simon Ruderich","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"235809","messageId":"6157736903dbcb3359eda07eff6f0faf832ef256.1393790234.git.simon@ruderich.org","threadId":"36025","inReplyTo":null,"subject":"[PATCH] git-config: document interactive.singlekey requires Term::Readkey","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2014-03-02T19:58:40Z","receivedAt":"2014-03-02T19:58:40Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"Most distributions don't require Term::Readkey as dependency,\nleaving the user to wonder why the setting doesn't work.\n\nSigned-off-by: Simon Ruderich <simon@ruderich.org>\n---\n Documentation/config.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 5f4d793..ec26fa8 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1633,7 +1633,7 @@ interactive.singlekey::\n \tlinkgit:git-add[1], linkgit:git-checkout[1], linkgit:git-commit[1],\n \tlinkgit:git-reset[1], and linkgit:git-stash[1]. Note that this\n \tsetting is silently ignored if portable keystroke input\n-\tis not available.\n+\tis not available; requires the Perl module Term::Readkey.\n \n log.abbrevCommit::\n \tIf true, makes linkgit:git-log[1], linkgit:git-show[1], and\n-- \n1.9.0.11.g9a08b42\n\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"},{"id":"235904","messageId":"xmqq1tyjqfbh.fsf@gitster.dls.corp.google.com","threadId":"36025","inReplyTo":"6157736903dbcb3359eda07eff6f0faf832ef256.1393790234.git.simon@ruderich.org","subject":"Re: [PATCH] git-config: document interactive.singlekey requires Term::Readkey","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-03T18:58:58Z","receivedAt":"2014-03-03T18:58:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Simon Ruderich <simon@ruderich.org> writes:\n\n> Most distributions don't require Term::Readkey as dependency,\n> leaving the user to wonder why the setting doesn't work.\n>\n> Signed-off-by: Simon Ruderich <simon@ruderich.org>\n\nThanks, but is it true that interactive.singlekey \"requries\"\nTerm::ReadKey?\n\nThe relevant part of git-add--interactive reads like so:\n\nif ($repo->config_bool(\"interactive.singlekey\")) {\n\teval {\n\t\trequire Term::ReadKey;\n\t\tTerm::ReadKey->import;\n\t\t$use_readkey = 1;\n\t};\n\teval {\n\t\trequire Term::Cap;\n\t\tmy $termcap = Term::Cap->Tgetent;\n\t\tforeach (values %$termcap) {\n\t\t\t$term_escapes{$_} = 1 if /^\\e/;\n\t\t}\n\t\t$use_termcap = 1;\n\t};\n}\n\nThe implementation of prompt_single_character sub wants to use\nReadKey, but can still let the user interact with the program by\nfalling back to a cooked input when it is not available, so perhaps\na better fix might be something like this:\n\n        if (!$use_readkey) {\n        \tprint STDERR \"missing Term::ReadKey, disabling interactive.singlekey\\n\";\n        }\n\ninside the above if() that prepares $use_readkey?\n\nYou also misspelled the package name it seems ;-)\n"},{"id":"235920","messageId":"20140303211549.GA24857@ruderich.org","threadId":"36025","inReplyTo":"xmqq1tyjqfbh.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] git-config: document interactive.singlekey requires Term::ReadKey","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2014-03-03T21:15:50Z","receivedAt":"2014-03-03T21:15:50Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"Most distributions don't require Term::ReadKey as dependency, leaving\nthe user to wonder why the setting doesn't work.\n\nSigned-off-by: Simon Ruderich <simon@ruderich.org>\n---\n\nOn Mon, Mar 03, 2014 at 10:58:58AM -0800, Junio C Hamano wrote:\n> Thanks, but is it true that interactive.singlekey \"requries\"\n> Term::ReadKey?\n\nYes, it requires it. The code also works fine without\nTerm::ReadKey, but the feature \"singlekey\" requires this module.\nI assumed a user enabling this option would also want to use the\nfeature, therefore \"requires\" is fine IMHO.\n\n> The implementation of prompt_single_character sub wants to use\n> ReadKey, but can still let the user interact with the program by\n> falling back to a cooked input when it is not available, so perhaps\n> a better fix might be something like this:\n>\n>         if (!$use_readkey) {\n>         \tprint STDERR \"missing Term::ReadKey, disabling interactive.singlekey\\n\";\n>         }\n>\n> inside the above if() that prepares $use_readkey?\n\nGood idea. Implemented in an additional patch.\n\nI think the documentation should also be updated (this patch) to\nmake it clear to a reader of the man page, that an additional\nmodule is required, without having him to try to use the option.\n\n> You also misspelled the package name it seems ;-)\n\nOops, sorry. Fixed in this reroll.\n\nRegards\nSimon\n\n Documentation/config.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 5f4d793..406a582 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1633,7 +1633,7 @@ interactive.singlekey::\n \tlinkgit:git-add[1], linkgit:git-checkout[1], linkgit:git-commit[1],\n \tlinkgit:git-reset[1], and linkgit:git-stash[1]. Note that this\n \tsetting is silently ignored if portable keystroke input\n-\tis not available.\n+\tis not available; requires the Perl module Term::ReadKey.\n \n log.abbrevCommit::\n \tIf true, makes linkgit:git-log[1], linkgit:git-show[1], and\n-- \n1.9.0.11.g9a08b42\n\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"},{"id":"235921","messageId":"f5d9de10d80bd2087e6082ba1e12ef65d3f083e3.1393880573.git.simon@ruderich.org","threadId":"36025","inReplyTo":"xmqq1tyjqfbh.fsf@gitster.dls.corp.google.com","subject":"[PATCH] git-add--interactive: warn if module for interactive.singlekey is missing","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2014-03-03T21:16:12Z","receivedAt":"2014-03-03T21:16:12Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"Suggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Simon Ruderich <simon@ruderich.org>\n---\n git-add--interactive.perl | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex 24bb1ab..d3bca12 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -58,6 +58,9 @@ if ($repo->config_bool(\"interactive.singlekey\")) {\n \t\tTerm::ReadKey->import;\n \t\t$use_readkey = 1;\n \t};\n+\tif (!$use_readkey) {\n+\t\tprint STDERR \"missing Term::ReadKey, disabling interactive.singlekey\\n\";\n+\t}\n \teval {\n \t\trequire Term::Cap;\n \t\tmy $termcap = Term::Cap->Tgetent;\n-- \n1.9.0.11.g9a08b42\n\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"}]}