Merge branch 'jk/repack-ref-racefix' into maint
[git/gitweb.git] / builtin / credential.c
blob0412fa00f0c85af6e7d3b4f802d6aeecf0c1ae16
1 #include "git-compat-util.h"
2 #include "credential.h"
3 #include "builtin.h"
5 static const char usage_msg[] =
6 "git credential [fill|approve|reject]";
8 int cmd_credential(int argc, const char **argv, const char *prefix)
10 const char *op;
11 struct credential c = CREDENTIAL_INIT;
13 op = argv[1];
14 if (!op)
15 usage(usage_msg);
17 if (credential_read(&c, stdin) < 0)
18 die("unable to read credential from stdin");
20 if (!strcmp(op, "fill")) {
21 credential_fill(&c);
22 credential_write(&c, stdout);
23 } else if (!strcmp(op, "approve")) {
24 credential_approve(&c);
25 } else if (!strcmp(op, "reject")) {
26 credential_reject(&c);
27 } else {
28 usage(usage_msg);
30 return 0;