Skip to content

Commit d3e7da8

Browse files
Anselm Kruisgitster
authored andcommitted
Add a new option 'core.askpass'.
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>
1 parent 64fdc08 commit d3e7da8

5 files changed

Lines changed: 14 additions & 1 deletion

File tree

Documentation/config.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,12 @@ core.excludesfile::
450450
to the value of `$HOME` and "{tilde}user/" to the specified user's
451451
home directory. See linkgit:gitignore[5].
452452

453+
core.askpass::
454+
Some commands (e.g. svn and http interfaces) that interactively
455+
ask for a password can be told to use an external program given
456+
via the value of this variable when it is set, and the
457+
environment variable `GIT_ASKPASS` is not set.
458+
453459
core.editor::
454460
Commands such as `commit` and `tag` that lets you edit
455461
messages by launching an editor uses the value of this

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@ extern int pager_in_use(void);
10291029
extern int pager_use_color;
10301030

10311031
extern const char *editor_program;
1032+
extern const char *askpass_program;
10321033
extern const char *excludes_file;
10331034

10341035
/* base85 */

config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ static int git_default_core_config(const char *var, const char *value)
560560
if (!strcmp(var, "core.editor"))
561561
return git_config_string(&editor_program, var, value);
562562

563+
if (!strcmp(var, "core.askpass"))
564+
return git_config_string(&askpass_program, var, value);
565+
563566
if (!strcmp(var, "core.excludesfile"))
564567
return git_config_pathname(&excludes_file, var, value);
565568

connect.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,12 +621,14 @@ int finish_connect(struct child_process *conn)
621621

622622
char *git_getpass(const char *prompt)
623623
{
624-
char *askpass;
624+
const char *askpass;
625625
struct child_process pass;
626626
const char *args[3];
627627
static struct strbuf buffer = STRBUF_INIT;
628628

629629
askpass = getenv("GIT_ASKPASS");
630+
if (!askpass)
631+
askpass = askpass_program;
630632

631633
if (!askpass || !(*askpass))
632634
return getpass(prompt);

environment.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ size_t delta_base_cache_limit = 16 * 1024 * 1024;
3737
const char *pager_program;
3838
int pager_use_color = 1;
3939
const char *editor_program;
40+
const char *askpass_program;
4041
const char *excludes_file;
4142
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
4243
int read_replace_refs = 1;

0 commit comments

Comments
 (0)