diff options
author | Anselm Kruis <a.kruis@science-computing.de> | 2010-08-30 15:38:38 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-08-31 10:49:02 -0700 |
commit | d3e7da8979f6ee3edd88fe53241095921d578285 (patch) | |
tree | 8d552c146371757f1fddfad301148d5265424c60 | |
parent | Git 1.7.2 (diff) | |
download | tgif-d3e7da8979f6ee3edd88fe53241095921d578285.tar.xz |
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>
-rw-r--r-- | Documentation/config.txt | 6 | ||||
-rw-r--r-- | cache.h | 1 | ||||
-rw-r--r-- | config.c | 3 | ||||
-rw-r--r-- | connect.c | 4 | ||||
-rw-r--r-- | environment.c | 1 |
5 files changed, 14 insertions, 1 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index e75434b3ef..b9ab7dfa01 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -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 @@ -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 */ @@ -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); @@ -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); diff --git a/environment.c b/environment.c index 83d38d3c23..e7760d8198 100644 --- a/environment.c +++ b/environment.c @@ -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; |