Skip to content
/ git Public
forked from git/git

Commit

Permalink
Add a new option 'core.askpass'.
Browse files Browse the repository at this point in the history
Setting this option has the same effect as setting the environment variable
'GIT_ASKPASS'.

Signed-off-by: Knut Franke <k.franke@science-computing.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Anselm Kruis authored and gitster committed Aug 31, 2010
1 parent 64fdc08 commit d3e7da8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ core.excludesfile::
to the value of `$HOME` and "{tilde}user/" to the specified user's
home directory. See linkgit:gitignore[5].

core.askpass::
Some commands (e.g. svn and http interfaces) that interactively
ask for a password can be told to use an external program given
via the value of this variable when it is set, and the
environment variable `GIT_ASKPASS` is not set.

core.editor::
Commands such as `commit` and `tag` that lets you edit
messages by launching an editor uses the value of this
Expand Down
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ extern int pager_in_use(void);
extern int pager_use_color;

extern const char *editor_program;
extern const char *askpass_program;
extern const char *excludes_file;

/* base85 */
Expand Down
3 changes: 3 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ static int git_default_core_config(const char *var, const char *value)
if (!strcmp(var, "core.editor"))
return git_config_string(&editor_program, var, value);

if (!strcmp(var, "core.askpass"))
return git_config_string(&askpass_program, var, value);

if (!strcmp(var, "core.excludesfile"))
return git_config_pathname(&excludes_file, var, value);

Expand Down
4 changes: 3 additions & 1 deletion connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,14 @@ int finish_connect(struct child_process *conn)

char *git_getpass(const char *prompt)
{
char *askpass;
const char *askpass;
struct child_process pass;
const char *args[3];
static struct strbuf buffer = STRBUF_INIT;

askpass = getenv("GIT_ASKPASS");
if (!askpass)
askpass = askpass_program;

if (!askpass || !(*askpass))
return getpass(prompt);
Expand Down
1 change: 1 addition & 0 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ size_t delta_base_cache_limit = 16 * 1024 * 1024;
const char *pager_program;
int pager_use_color = 1;
const char *editor_program;
const char *askpass_program;
const char *excludes_file;
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
int read_replace_refs = 1;
Expand Down

0 comments on commit d3e7da8

Please sign in to comment.