From: roucherj <roucherj@telesun.imag.fr>
To: <konglu@minatec.inpg.fr>
Cc: <Javier.Roucher-Iglesias@ensimag.imag.fr>, <git@vger.kernel.org>,
Javier Roucher <jroucher@gmail.com>,
Pavel Volek <Pavel.Volek@ensimag.imag.fr>,
NGUYEN Kim Thuat <Kim-Thuat.Nguyen@ensimag.imag.fr>,
ROUCHER IGLESIAS Javier <roucherj@ensimag.imag.fr>,
Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: Re: [PATCH v3] add 'git credential' plumbing command
Date: Mon, 11 Jun 2012 21:14:00 +0200 [thread overview]
Message-ID: <0425823888ed7e40d9332e148ac9e77a@telesun.imag.fr> (raw)
In-Reply-To: <20120611210745.Horde.72y3YnwdC4BP1kIBup3BWrA@webmail.minatec.grenoble-inp.fr>
On Mon, 11 Jun 2012 21:07:45 +0200, konglu@minatec.inpg.fr wrote:
> Javier.Roucher-Iglesias@ensimag.imag.fr a écrit :
>
>> +Git-credential permits to the user of the script to save:
>> +username, password, host, path and protocol. When the user of
>> script
>> +invoke git-credential, the script can ask for a password, using the
>> command
>> +'git credential fill'.
>> +Taking data from the standard input, the program treats each line
>> as a
>> +separate data item, and the end of series of data item is signalled
>> by a
>> +blank line.
>> +
>> + username=admin\n
>> + protocol=[http|https]\n
>> + host=localhost\n
>> + path=/dir\n\n
>> +
>> +-If git-credential system has the password already stored
>> +git-credential will answer with by STDOUT:
>> +
>> + username=admin
>> + password=*****
>> +
>> +-If it is not stored, the user will be prompt for a password:
>> +
>> + > Password for '[http|https]admin@localhost':
>
> Whitespaces detected (and also some more after in the doc)
>
>> diff --git a/builtin/credential.c b/builtin/credential.c
>> new file mode 100644
>> index 0000000..a6b6962
>> --- /dev/null
>> +++ b/builtin/credential.c
>> @@ -0,0 +1,37 @@
>> +#include <stdio.h>
>> +#include "cache.h"
>> +#include "credential.h"
>> +#include "string-list.h"
>> +
>> +static const char usage_msg[] =
>> +"credential <fill|approve|reject>";
>> +
>> +void cmd_credential (int argc, char **argv, const char *prefix) {
>> + const char *op;
>> + struct credential c = CREDENTIAL_INIT;
>> + int i;
>> +
>> + op = argv[1];
>> + if (!op)
>> + usage(usage_msg);
>> +
>> + if (credential_read(&c, stdin) < 0)
>> + die("unable to read credential from stdin");
>> +
>> + if (!strcmp(op, "fill")) {
>> + credential_fill(&c);
>> + if (c.username)
>> + printf("username=%s\n", c.username);
>> + if (c.password)
>> + printf("password=%s\n", c.password);
>> + }
>> + else if (!strcmp(op, "approve")) {
>> + credential_approve(&c);
>> + }
>> + else if (!strcmp(op, "reject")) {
>> + credential_reject(&c);
>> + }
>> + else {
>> + usage(usage_msg);
>> + }
>> +}
>
> Structure:
>
> if (!strcmp(op, "fill")) {
> credential_fill(&c);
> if (c.username)
> printf("username=%s\n", c.username);
> if (c.password)
> printf("password=%s\n", c.password);
> } else if (!strcmp(op, "approve")) {
> credential_approve(&c);
> } else if (!strcmp(op, "reject")) {
> credential_reject(&c);
> } else {
> usage(usage_msg);
> }
I will change the structure, thanks.
prev parent reply other threads:[~2012-06-11 19:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 18:44 [PATCH v3] add 'git credential' plumbing command Javier.Roucher-Iglesias
2012-06-11 19:04 ` Matthieu Moy
2012-06-11 19:12 ` roucherj
2012-06-11 19:07 ` konglu
2012-06-11 19:14 ` roucherj [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0425823888ed7e40d9332e148ac9e77a@telesun.imag.fr \
--to=roucherj@telesun.imag.fr \
--cc=Javier.Roucher-Iglesias@ensimag.imag.fr \
--cc=Kim-Thuat.Nguyen@ensimag.imag.fr \
--cc=Matthieu.Moy@imag.fr \
--cc=Pavel.Volek@ensimag.imag.fr \
--cc=git@vger.kernel.org \
--cc=jroucher@gmail.com \
--cc=konglu@minatec.inpg.fr \
--cc=roucherj@ensimag.imag.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox