swh:1:snp:47f1e8bb459169b0feb652a9c3d9cbabd8526d4a
Raw File
Tip revision: 362de916c06521205276acb7f51c99f47db94727 authored by Junio C Hamano on 10 June 2013, 00:16:20 UTC
Git 1.8.3.1
Tip revision: 362de91
credential.c
#include "git-compat-util.h"
#include "credential.h"
#include "builtin.h"

static const char usage_msg[] =
	"git credential [fill|approve|reject]";

int cmd_credential(int argc, const char **argv, const char *prefix)
{
	const char *op;
	struct credential c = CREDENTIAL_INIT;

	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);
		credential_write(&c, stdout);
	} else if (!strcmp(op, "approve")) {
		credential_approve(&c);
	} else if (!strcmp(op, "reject")) {
		credential_reject(&c);
	} else {
		usage(usage_msg);
	}
	return 0;
}
back to top