git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-config: document interactive.singlekey requires Term::Readkey
@ 2014-03-02 19:58 Simon Ruderich
  2014-03-03 18:58 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Ruderich @ 2014-03-02 19:58 UTC (permalink / raw
  To: git

Most distributions don't require Term::Readkey as dependency,
leaving the user to wonder why the setting doesn't work.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
---
 Documentation/config.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5f4d793..ec26fa8 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1633,7 +1633,7 @@ interactive.singlekey::
 	linkgit:git-add[1], linkgit:git-checkout[1], linkgit:git-commit[1],
 	linkgit:git-reset[1], and linkgit:git-stash[1]. Note that this
 	setting is silently ignored if portable keystroke input
-	is not available.
+	is not available; requires the Perl module Term::Readkey.
 
 log.abbrevCommit::
 	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
-- 
1.9.0.11.g9a08b42

-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-config: document interactive.singlekey requires Term::Readkey
  2014-03-02 19:58 [PATCH] git-config: document interactive.singlekey requires Term::Readkey Simon Ruderich
@ 2014-03-03 18:58 ` Junio C Hamano
  2014-03-03 21:15   ` [PATCH v2] git-config: document interactive.singlekey requires Term::ReadKey Simon Ruderich
  2014-03-03 21:16   ` [PATCH] git-add--interactive: warn if module for interactive.singlekey is missing Simon Ruderich
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2014-03-03 18:58 UTC (permalink / raw
  To: Simon Ruderich; +Cc: git

Simon Ruderich <simon@ruderich.org> writes:

> Most distributions don't require Term::Readkey as dependency,
> leaving the user to wonder why the setting doesn't work.
>
> Signed-off-by: Simon Ruderich <simon@ruderich.org>

Thanks, but is it true that interactive.singlekey "requries"
Term::ReadKey?

The relevant part of git-add--interactive reads like so:

if ($repo->config_bool("interactive.singlekey")) {
	eval {
		require Term::ReadKey;
		Term::ReadKey->import;
		$use_readkey = 1;
	};
	eval {
		require Term::Cap;
		my $termcap = Term::Cap->Tgetent;
		foreach (values %$termcap) {
			$term_escapes{$_} = 1 if /^\e/;
		}
		$use_termcap = 1;
	};
}

The implementation of prompt_single_character sub wants to use
ReadKey, but can still let the user interact with the program by
falling back to a cooked input when it is not available, so perhaps
a better fix might be something like this:

        if (!$use_readkey) {
        	print STDERR "missing Term::ReadKey, disabling interactive.singlekey\n";
        }

inside the above if() that prepares $use_readkey?

You also misspelled the package name it seems ;-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] git-config: document interactive.singlekey requires Term::ReadKey
  2014-03-03 18:58 ` Junio C Hamano
@ 2014-03-03 21:15   ` Simon Ruderich
  2014-03-03 21:16   ` [PATCH] git-add--interactive: warn if module for interactive.singlekey is missing Simon Ruderich
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Ruderich @ 2014-03-03 21:15 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git

Most distributions don't require Term::ReadKey as dependency, leaving
the user to wonder why the setting doesn't work.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
---

On Mon, Mar 03, 2014 at 10:58:58AM -0800, Junio C Hamano wrote:
> Thanks, but is it true that interactive.singlekey "requries"
> Term::ReadKey?

Yes, it requires it. The code also works fine without
Term::ReadKey, but the feature "singlekey" requires this module.
I assumed a user enabling this option would also want to use the
feature, therefore "requires" is fine IMHO.

> The implementation of prompt_single_character sub wants to use
> ReadKey, but can still let the user interact with the program by
> falling back to a cooked input when it is not available, so perhaps
> a better fix might be something like this:
>
>         if (!$use_readkey) {
>         	print STDERR "missing Term::ReadKey, disabling interactive.singlekey\n";
>         }
>
> inside the above if() that prepares $use_readkey?

Good idea. Implemented in an additional patch.

I think the documentation should also be updated (this patch) to
make it clear to a reader of the man page, that an additional
module is required, without having him to try to use the option.

> You also misspelled the package name it seems ;-)

Oops, sorry. Fixed in this reroll.

Regards
Simon

 Documentation/config.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5f4d793..406a582 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1633,7 +1633,7 @@ interactive.singlekey::
 	linkgit:git-add[1], linkgit:git-checkout[1], linkgit:git-commit[1],
 	linkgit:git-reset[1], and linkgit:git-stash[1]. Note that this
 	setting is silently ignored if portable keystroke input
-	is not available.
+	is not available; requires the Perl module Term::ReadKey.
 
 log.abbrevCommit::
 	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
-- 
1.9.0.11.g9a08b42

-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] git-add--interactive: warn if module for interactive.singlekey is missing
  2014-03-03 18:58 ` Junio C Hamano
  2014-03-03 21:15   ` [PATCH v2] git-config: document interactive.singlekey requires Term::ReadKey Simon Ruderich
@ 2014-03-03 21:16   ` Simon Ruderich
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Ruderich @ 2014-03-03 21:16 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Simon Ruderich <simon@ruderich.org>
---
 git-add--interactive.perl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 24bb1ab..d3bca12 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -58,6 +58,9 @@ if ($repo->config_bool("interactive.singlekey")) {
 		Term::ReadKey->import;
 		$use_readkey = 1;
 	};
+	if (!$use_readkey) {
+		print STDERR "missing Term::ReadKey, disabling interactive.singlekey\n";
+	}
 	eval {
 		require Term::Cap;
 		my $termcap = Term::Cap->Tgetent;
-- 
1.9.0.11.g9a08b42

-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-03 21:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-02 19:58 [PATCH] git-config: document interactive.singlekey requires Term::Readkey Simon Ruderich
2014-03-03 18:58 ` Junio C Hamano
2014-03-03 21:15   ` [PATCH v2] git-config: document interactive.singlekey requires Term::ReadKey Simon Ruderich
2014-03-03 21:16   ` [PATCH] git-add--interactive: warn if module for interactive.singlekey is missing Simon Ruderich

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).