* [PATCH 1/2] Add a new option 'core.askpass'.
@ 2010-08-27 10:51 Knut Franke
2010-08-27 17:28 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Knut Franke @ 2010-08-27 10:51 UTC (permalink / raw)
To: git; +Cc: Frank Li
From: Anselm Kruis <a.kruis@science-computing.de>
Setting this option has the same effect as setting the environment variable
'GIT_ASKPASS'.
Signed-off-by: Knut Franke <k.franke@science-computing.de>
---
This is useful if you have a wrapper script around git-clone doing some site-
specific customizations, but want users to be able to use plain git commands
for other operations.
Documentation/config.txt | 6 ++++++
cache.h | 1 +
config.c | 3 +++
connect.c | 4 +++-
environment.c | 1 +
5 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 05ec3fe..38678db 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
diff --git a/cache.h b/cache.h
index eb77e1d..608d20a 100644
--- a/cache.h
+++ b/cache.h
@@ -1032,6 +1032,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 */
diff --git a/config.c b/config.c
index cdcf583..ac55730 100644
--- a/config.c
+++ b/config.c
@@ -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);
diff --git a/connect.c b/connect.c
index 02e738a..e296bfc 100644
--- a/connect.c
+++ b/connect.c
@@ -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 83d38d3..e7760d8 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;
--
1.7.2.1
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier,
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Add a new option 'core.askpass'.
2010-08-27 10:51 [PATCH 1/2] Add a new option 'core.askpass' Knut Franke
@ 2010-08-27 17:28 ` Junio C Hamano
2010-08-30 11:44 ` Knut Franke
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2010-08-27 17:28 UTC (permalink / raw)
To: Knut Franke; +Cc: git, Frank Li
Knut Franke <k.franke@science-computing.de> writes:
> From: Anselm Kruis <a.kruis@science-computing.de>
>
> Setting this option has the same effect as setting the environment variable
> 'GIT_ASKPASS'.
>
> Signed-off-by: Knut Franke <k.franke@science-computing.de>
> ---
> This is useful if you have a wrapper script around git-clone doing some site-
> specific customizations, but want users to be able to use plain git commands
> for other operations.
I don't see ASKPASS documented anywhere in the Documentation/ in the first
place. Perhaps we would want to fix that while we are at it. Also this
does not feel like a "core." thing, but it may be just me.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Add a new option 'core.askpass'.
2010-08-27 17:28 ` Junio C Hamano
@ 2010-08-30 11:44 ` Knut Franke
2010-08-30 12:17 ` Erik Faye-Lund
2010-08-30 13:56 ` Jonathan Nieder
0 siblings, 2 replies; 6+ messages in thread
From: Knut Franke @ 2010-08-30 11:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Frank Li
On Friday 27 August 2010 19:28:38 Junio C Hamano wrote:
> I don't see ASKPASS documented anywhere in the Documentation/ in the first
> place. Perhaps we would want to fix that while we are at it.
It's at least mentioned in the core.askpass documentation added by the patch,
but I'll try to improve.
Incidentally, the documentation for other environment variables
(GIT_PROXY_COMMAND, GIT_SSL_CERT, GIT_SSL_KEY, GIT_SSL_NO_VERIFY,
GIT_SSL_CERT_PASSWORD_PROTECTED, GIT_SSL_CAINFO, GIT_SSL_CAPATH)
is equally sparse.
> Also this
> does not feel like a "core." thing, but it may be just me.
Where else could it go? It's not entirely http specific:
$ grep git_getpass *.c
connect.c:char *git_getpass(const char *prompt)
http.c: user_pass = xstrdup(git_getpass("Password: "));
http.c: ssl_cert_password = git_getpass("Certificate Password: ");
http.c: * git_getpass is needed here because its very likely stdin/stdout are
http.c: * but that is non-portable. Using git_getpass() can at least be stubbed
http.c: user_name = xstrdup(git_getpass("Username: "));
imap-send.c: arg = git_getpass(prompt);
Nor does it relate to a single command.
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier,
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Add a new option 'core.askpass'.
2010-08-30 11:44 ` Knut Franke
@ 2010-08-30 12:17 ` Erik Faye-Lund
2010-08-30 13:56 ` Jonathan Nieder
1 sibling, 0 replies; 6+ messages in thread
From: Erik Faye-Lund @ 2010-08-30 12:17 UTC (permalink / raw)
To: Knut Franke; +Cc: Junio C Hamano, git, Frank Li
On Mon, Aug 30, 2010 at 1:44 PM, Knut Franke
<k.franke@science-computing.de> wrote:
> On Friday 27 August 2010 19:28:38 Junio C Hamano wrote:
>> I don't see ASKPASS documented anywhere in the Documentation/ in the first
>> place. Perhaps we would want to fix that while we are at it.
>
> It's at least mentioned in the core.askpass documentation added by the patch,
> but I'll try to improve.
>
> Incidentally, the documentation for other environment variables
> (GIT_PROXY_COMMAND, GIT_SSL_CERT, GIT_SSL_KEY, GIT_SSL_NO_VERIFY,
> GIT_SSL_CERT_PASSWORD_PROTECTED, GIT_SSL_CAINFO, GIT_SSL_CAPATH)
> is equally sparse.
>
>> Also this
>> does not feel like a "core." thing, but it may be just me.
>
> Where else could it go? It's not entirely http specific:
>
Perhaps "user.getpass"? But I have to admit, I agree with you that
"core.askpass" is the most natural choice. It doesn't describe the
user, it describes the mechanism to authenticate any user at any
remote host, which IMO is much more a "core" matter.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Add a new option 'core.askpass'.
2010-08-30 11:44 ` Knut Franke
2010-08-30 12:17 ` Erik Faye-Lund
@ 2010-08-30 13:56 ` Jonathan Nieder
2010-08-30 14:17 ` Jonathan Nieder
1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Nieder @ 2010-08-30 13:56 UTC (permalink / raw)
To: Knut Franke; +Cc: Junio C Hamano, git, Frank Li
Knut Franke wrote:
> On Friday 27 August 2010 19:28:38 Junio C Hamano wrote:
>> Also this
>> does not feel like a "core." thing, but it may be just me.
>
> Where else could it go? It's not entirely http specific:
>
> $ grep git_getpass *.c
> connect.c:char *git_getpass(const char *prompt)
> http.c: user_pass = xstrdup(git_getpass("Password: "));
> http.c: ssl_cert_password = git_getpass("Certificate Password: ");
> http.c: * git_getpass is needed here because its very likely stdin/stdout are
> http.c: * but that is non-portable. Using git_getpass() can at least be stubbed
> http.c: user_name = xstrdup(git_getpass("Username: "));
> imap-send.c: arg = git_getpass(prompt);
>
> Nor does it relate to a single command.
Perhaps "push.askpass" and "imap.askpass", maybe with the latter
defaulting to the former or something? This would help preserve
the illusion that the git commands are sort of independent tools.
Haven't thought deeply about it at all, though.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Add a new option 'core.askpass'.
2010-08-30 13:56 ` Jonathan Nieder
@ 2010-08-30 14:17 ` Jonathan Nieder
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2010-08-30 14:17 UTC (permalink / raw)
To: Knut Franke; +Cc: Junio C Hamano, git, Frank Li
Jonathan Nieder wrote:
> Perhaps "push.askpass" and "imap.askpass", maybe with the latter
> defaulting to the former or something? This would help preserve
> the illusion that the git commands are sort of independent tools.
>
> Haven't thought deeply about it at all, though.
Oh, it's used for fetch, too. Forget I said anything, then.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-08-30 14:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-27 10:51 [PATCH 1/2] Add a new option 'core.askpass' Knut Franke
2010-08-27 17:28 ` Junio C Hamano
2010-08-30 11:44 ` Knut Franke
2010-08-30 12:17 ` Erik Faye-Lund
2010-08-30 13:56 ` Jonathan Nieder
2010-08-30 14:17 ` Jonathan Nieder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).