diff options
author | Javier Roucher Iglesias <Javier.Roucher-Iglesias@ensimag.imag.fr> | 2012-06-24 13:39:59 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-25 11:55:51 -0700 |
commit | e30b2feb1b50c2d14d32dc3e6e41f7b20a677ff2 (patch) | |
tree | 364c41094e77b5d806ea0c2c07a77ffab499f2e0 /test-credential.c | |
parent | fd378070c8171ba33a9b1aeca37085e6dfbff35b (diff) | |
download | git-e30b2feb1b50c2d14d32dc3e6e41f7b20a677ff2.tar.gz |
add 'git credential' plumbing command
The credential API is in C, and not available to scripting languages.
Expose the functionalities of the API by wrapping them into a new
plumbing command "git credentials".
In other words, replace the internal "test-credential" by an official Git
command.
Most documentation writen by: Jeff King <peff@peff.net>
Signed-off-by: Pavel Volek <Pavel.Volek@ensimag.imag.fr>
Signed-off-by: Kim Thuat Nguyen <Kim-Thuat.Nguyen@ensimag.imag.fr>
Signed-off-by: Javier Roucher Iglesias <Javier.Roucher-Iglesias@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-credential.c')
-rw-r--r-- | test-credential.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/test-credential.c b/test-credential.c deleted file mode 100644 index dee200e7f2..0000000000 --- a/test-credential.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "cache.h" -#include "credential.h" -#include "string-list.h" - -static const char usage_msg[] = -"test-credential <fill|approve|reject> [helper...]"; - -int main(int argc, const char **argv) -{ - const char *op; - struct credential c = CREDENTIAL_INIT; - int i; - - op = argv[1]; - if (!op) - usage(usage_msg); - for (i = 2; i < argc; i++) - string_list_append(&c.helpers, argv[i]); - - 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); - - return 0; -} |