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>
Anselm Kruis committed
Aug 30, 2010 at 15:38 UTC
d3e7da8979f6ee3edd88fe53241095921d578285
5 files changed
+14
-1
Documentation/config.txt
+6
@@ -450,6 +450,12 @@ core.excludesfile::
450
to the value of `$HOME` and "{tilde}user/" to the specified user's
451
home directory. See linkgit:gitignore[5].
452
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
+
459
core.editor::
460
Commands such as `commit` and `tag` that lets you edit
461
messages by launching an editor uses the value of this
cache.h
+1
@@ -1029,6 +1029,7 @@ extern int pager_in_use(void);
1029
extern int pager_use_color;
1030
1031
extern const char *editor_program;
1032
+extern const char *askpass_program;
1033
extern const char *excludes_file;
1034
1035
/* base85 */
config.c
+3
@@ -560,6 +560,9 @@ static int git_default_core_config(const char *var, const char *value)
560
if (!strcmp(var, "core.editor"))
561
return git_config_string(&editor_program, var, value);
562
563
+ if (!strcmp(var, "core.askpass"))
564
+ return git_config_string(&askpass_program, var, value);
565
+
566
if (!strcmp(var, "core.excludesfile"))
567
return git_config_pathname(&excludes_file, var, value);
568
connect.c
+3
-1
@@ -621,12 +621,14 @@ int finish_connect(struct child_process *conn)
621
622
char *git_getpass(const char *prompt)
623
{
624
- char *askpass;
624
+ const char *askpass;
625
struct child_process pass;
626
const char *args[3];
627
static struct strbuf buffer = STRBUF_INIT;
628
629
askpass = getenv("GIT_ASKPASS");
630
+ if (!askpass)
631
+ askpass = askpass_program;
632
633
if (!askpass || !(*askpass))
634
return getpass(prompt);
environment.c
+1
@@ -37,6 +37,7 @@ size_t delta_base_cache_limit = 16 * 1024 * 1024;
37
const char *pager_program;
38
int pager_use_color = 1;
39
const char *editor_program;
40
+const char *askpass_program;
41
const char *excludes_file;
42
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
43
int read_replace_refs = 1;