git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-config: document interactive.singlekey requires Term::Readkey

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2014, 18:58 UTC
Message-ID
<xmqq1tyjqfbh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<6157736903dbcb3359eda07eff6f0faf832ef256.1393790234.git.simon@ruderich.org>
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 ;-)
Previous: Simon RuderichNext: Simon Ruderich
Message 2 of 4 in “git-config: document interactive.singlekey requires Term::Readkey”
  1. git-config: document interactive.singlekey requires Term::ReadkeySimon Ruderich, Mar 2, 2014
  2. Junio C HamanoMar 3, 2014
  3. Simon RuderichMar 3, 2014
  4. git-add--interactive: warn if module for interactive.singlekey is missingSimon Ruderich, Mar 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.