{"thread":{"id":"24884","subject":"[PATCH 1/2] Add a new option 'core.askpass'.","startedAt":"2010-08-27T10:51:15Z","lastAt":"2010-08-30T14:17:39Z","messageCount":6,"participants":["Knut Franke","Junio C Hamano","Erik Faye-Lund","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"149115","messageId":"201008271251.19754.k.franke@science-computing.de","threadId":"24884","inReplyTo":null,"subject":"[PATCH 1/2] Add a new option 'core.askpass'.","fromName":"Knut Franke","fromEmail":"k.franke@science-computing.de","sentAt":"2010-08-27T10:51:15Z","receivedAt":"2010-08-27T10:51:15Z","isPatch":true,"sender":{"key":"knut.franke@gmx.de","avatar":null},"body":"From: Anselm Kruis <a.kruis@science-computing.de>\n\nSetting this option has the same effect as setting the environment variable\n'GIT_ASKPASS'.\n\nSigned-off-by: Knut Franke <k.franke@science-computing.de>\n---\nThis is useful if you have a wrapper script around git-clone doing some site-\nspecific customizations, but want users to be able to use plain git commands \nfor other operations.\n\n Documentation/config.txt |    6 ++++++\n cache.h                  |    1 +\n config.c                 |    3 +++\n connect.c                |    4 +++-\n environment.c            |    1 +\n 5 files changed, 14 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 05ec3fe..38678db 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -450,6 +450,12 @@ core.excludesfile::\n \tto the value of `$HOME` and \"{tilde}user/\" to the specified user's\n \thome directory.  See linkgit:gitignore[5].\n \n+core.askpass::\n+\tSome commands (e.g. svn and http interfaces) that interactively\n+\task for a password can be told to use an external program given\n+\tvia the value of this variable when it is set, and the\n+\tenvironment variable `GIT_ASKPASS` is not set.\n+\n core.editor::\n \tCommands such as `commit` and `tag` that lets you edit\n \tmessages by launching an editor uses the value of this\ndiff --git a/cache.h b/cache.h\nindex eb77e1d..608d20a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1032,6 +1032,7 @@ extern int pager_in_use(void);\n extern int pager_use_color;\n \n extern const char *editor_program;\n+extern const char *askpass_program;\n extern const char *excludes_file;\n \n /* base85 */\ndiff --git a/config.c b/config.c\nindex cdcf583..ac55730 100644\n--- a/config.c\n+++ b/config.c\n@@ -560,6 +560,9 @@ static int git_default_core_config(const char *var, const \nchar *value)\n \tif (!strcmp(var, \"core.editor\"))\n \t\treturn git_config_string(&editor_program, var, value);\n \n+\tif (!strcmp(var, \"core.askpass\"))\n+\t\treturn git_config_string(&askpass_program, var, value);\n+\n \tif (!strcmp(var, \"core.excludesfile\"))\n \t\treturn git_config_pathname(&excludes_file, var, value);\n \ndiff --git a/connect.c b/connect.c\nindex 02e738a..e296bfc 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -621,12 +621,14 @@ int finish_connect(struct child_process *conn)\n \n char *git_getpass(const char *prompt)\n {\n-\tchar *askpass;\n+\tconst char *askpass;\n \tstruct child_process pass;\n \tconst char *args[3];\n \tstatic struct strbuf buffer = STRBUF_INIT;\n \n \taskpass = getenv(\"GIT_ASKPASS\");\n+\tif (!askpass)\n+\t\taskpass = askpass_program;\n \n \tif (!askpass || !(*askpass))\n \t\treturn getpass(prompt);\ndiff --git a/environment.c b/environment.c\nindex 83d38d3..e7760d8 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -37,6 +37,7 @@ size_t delta_base_cache_limit = 16 * 1024 * 1024;\n const char *pager_program;\n int pager_use_color = 1;\n const char *editor_program;\n+const char *askpass_program;\n const char *excludes_file;\n enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;\n int read_replace_refs = 1;\n-- \n1.7.2.1\n\n-- \nVorstand/Board of Management:\nDr. Bernd Finkbeiner, Dr. Roland Niemeier, \nDr. Arno Steitz, Dr. Ingrid Zech\nVorsitzender des Aufsichtsrats/\nChairman of the Supervisory Board:\nMichel Lepert\nSitz/Registered Office: Tuebingen\nRegistergericht/Registration Court: Stuttgart\nRegisternummer/Commercial Register No.: HRB 382196 \n"},{"id":"149132","messageId":"7vaao8hsmx.fsf@alter.siamese.dyndns.org","threadId":"24884","inReplyTo":"201008271251.19754.k.franke@science-computing.de","subject":"Re: [PATCH 1/2] Add a new option 'core.askpass'.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-27T17:28:38Z","receivedAt":"2010-08-27T17:28:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Knut Franke <k.franke@science-computing.de> writes:\n\n> From: Anselm Kruis <a.kruis@science-computing.de>\n>\n> Setting this option has the same effect as setting the environment variable\n> 'GIT_ASKPASS'.\n>\n> Signed-off-by: Knut Franke <k.franke@science-computing.de>\n> ---\n> This is useful if you have a wrapper script around git-clone doing some site-\n> specific customizations, but want users to be able to use plain git commands \n> for other operations.\n\nI don't see ASKPASS documented anywhere in the Documentation/ in the first\nplace.  Perhaps we would want to fix that while we are at it.  Also this\ndoes not feel like a \"core.\" thing, but it may be just me.\n"},{"id":"149305","messageId":"201008301344.22983.k.franke@science-computing.de","threadId":"24884","inReplyTo":"7vaao8hsmx.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] Add a new option 'core.askpass'.","fromName":"Knut Franke","fromEmail":"k.franke@science-computing.de","sentAt":"2010-08-30T11:44:21Z","receivedAt":"2010-08-30T11:44:21Z","isPatch":true,"sender":{"key":"knut.franke@gmx.de","avatar":null},"body":"On Friday 27 August 2010 19:28:38 Junio C Hamano wrote:\n> I don't see ASKPASS documented anywhere in the Documentation/ in the first\n> place.  Perhaps we would want to fix that while we are at it.\n\nIt's at least mentioned in the core.askpass documentation added by the patch,\nbut I'll try to improve.\n\nIncidentally, the documentation for other environment variables\n(GIT_PROXY_COMMAND, GIT_SSL_CERT, GIT_SSL_KEY, GIT_SSL_NO_VERIFY,\nGIT_SSL_CERT_PASSWORD_PROTECTED, GIT_SSL_CAINFO, GIT_SSL_CAPATH)\nis equally sparse.\n\n> Also this\n> does not feel like a \"core.\" thing, but it may be just me.\n\nWhere else could it go? It's not entirely http specific:\n\n$ grep git_getpass *.c\nconnect.c:char *git_getpass(const char *prompt)\nhttp.c:                 user_pass = xstrdup(git_getpass(\"Password: \"));\nhttp.c: ssl_cert_password = git_getpass(\"Certificate Password: \");\nhttp.c:                          * git_getpass is needed here because its very likely stdin/stdout are\nhttp.c:                          * but that is non-portable.  Using git_getpass() can at least be stubbed\nhttp.c:                         user_name = xstrdup(git_getpass(\"Username: \"));\nimap-send.c:                    arg = git_getpass(prompt);\n\nNor does it relate to a single command.\n-- \nVorstand/Board of Management:\nDr. Bernd Finkbeiner, Dr. Roland Niemeier, \nDr. Arno Steitz, Dr. Ingrid Zech\nVorsitzender des Aufsichtsrats/\nChairman of the Supervisory Board:\nMichel Lepert\nSitz/Registered Office: Tuebingen\nRegistergericht/Registration Court: Stuttgart\nRegisternummer/Commercial Register No.: HRB 382196 \n"},{"id":"149308","messageId":"AANLkTimLzZpzgbY2tHVvZXRkhUCAnoGcgGM1eORhjaz=@mail.gmail.com","threadId":"24884","inReplyTo":"201008301344.22983.k.franke@science-computing.de","subject":"Re: [PATCH 1/2] Add a new option 'core.askpass'.","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2010-08-30T12:17:05Z","receivedAt":"2010-08-30T12:17:05Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Aug 30, 2010 at 1:44 PM, Knut Franke\n<k.franke@science-computing.de> wrote:\n> On Friday 27 August 2010 19:28:38 Junio C Hamano wrote:\n>> I don't see ASKPASS documented anywhere in the Documentation/ in the first\n>> place.  Perhaps we would want to fix that while we are at it.\n>\n> It's at least mentioned in the core.askpass documentation added by the patch,\n> but I'll try to improve.\n>\n> Incidentally, the documentation for other environment variables\n> (GIT_PROXY_COMMAND, GIT_SSL_CERT, GIT_SSL_KEY, GIT_SSL_NO_VERIFY,\n> GIT_SSL_CERT_PASSWORD_PROTECTED, GIT_SSL_CAINFO, GIT_SSL_CAPATH)\n> is equally sparse.\n>\n>> Also this\n>> does not feel like a \"core.\" thing, but it may be just me.\n>\n> Where else could it go? It's not entirely http specific:\n>\n\nPerhaps \"user.getpass\"? But I have to admit, I agree with you that\n\"core.askpass\" is the most natural choice. It doesn't describe the\nuser, it describes the mechanism to authenticate any user at any\nremote host, which IMO is much more a \"core\" matter.\n"},{"id":"149318","messageId":"20100830135658.GC2315@burratino","threadId":"24884","inReplyTo":"201008301344.22983.k.franke@science-computing.de","subject":"Re: [PATCH 1/2] Add a new option 'core.askpass'.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-30T13:56:58Z","receivedAt":"2010-08-30T13:56:58Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Knut Franke wrote:\n> On Friday 27 August 2010 19:28:38 Junio C Hamano wrote:\n\n>> Also this\n>> does not feel like a \"core.\" thing, but it may be just me.\n>\n> Where else could it go? It's not entirely http specific:\n>\n> $ grep git_getpass *.c\n> connect.c:char *git_getpass(const char *prompt)\n> http.c:                 user_pass = xstrdup(git_getpass(\"Password: \"));\n> http.c: ssl_cert_password = git_getpass(\"Certificate Password: \");\n> http.c:                          * git_getpass is needed here because its very likely stdin/stdout are\n> http.c:                          * but that is non-portable.  Using git_getpass() can at least be stubbed\n> http.c:                         user_name = xstrdup(git_getpass(\"Username: \"));\n> imap-send.c:                    arg = git_getpass(prompt);\n>\n> Nor does it relate to a single command.\n\nPerhaps \"push.askpass\" and \"imap.askpass\", maybe with the latter\ndefaulting to the former or something?  This would help preserve\nthe illusion that the git commands are sort of independent tools.\n\nHaven't thought deeply about it at all, though.\n"},{"id":"149325","messageId":"20100830141739.GG2315@burratino","threadId":"24884","inReplyTo":"20100830135658.GC2315@burratino","subject":"Re: [PATCH 1/2] Add a new option 'core.askpass'.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-30T14:17:39Z","receivedAt":"2010-08-30T14:17:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> Perhaps \"push.askpass\" and \"imap.askpass\", maybe with the latter\n> defaulting to the former or something?  This would help preserve\n> the illusion that the git commands are sort of independent tools.\n> \n> Haven't thought deeply about it at all, though.\n\nOh, it's used for fetch, too.  Forget I said anything, then.\n"}]}