Revision d5c1b7c286b2ad2206afe2f86ae228744bd283fb authored by Richard Hansen on 17 June 2015, 21:11:21 UTC, committed by Junio C Hamano on 17 June 2015, 22:16:52 UTC
If tput needs ~/.terminfo for the current $TERM, then tput will
succeed before HOME is changed to $TRASH_DIRECTORY (causing color to
be set to 't') but fail afterward.

One possible way to fix this is to treat HOME like TERM: back up the
original value and temporarily restore it before say_color() runs
tput.

Instead, pre-compute and save the color control sequences before
changing either TERM or HOME.  Use the saved control sequences in
say_color() rather than call tput each time.  This avoids the need to
back up and restore the TERM and HOME variables, and it avoids the
overhead of a subshell and two invocations of tput per call to
say_color().

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ca92a66
Raw File
prompt.h
#ifndef PROMPT_H
#define PROMPT_H

#define PROMPT_ASKPASS (1<<0)
#define PROMPT_ECHO    (1<<1)

char *git_prompt(const char *prompt, int flags);
char *git_getpass(const char *prompt);

#endif /* PROMPT_H */
back to top