Exemplo n.º 1
0
int cmd_verify_pack(int argc, const char **argv, const char *prefix)
{
	int err = 0;
	unsigned int flags = 0;
	int i;

#ifdef USE_CPLUSPLUS_FOR_INIT
#pragma cplusplus on
#endif

	const struct option verify_pack_options[] = {
		OPT_BIT('v', "verbose", &flags, "verbose",
			VERIFY_PACK_VERBOSE),
		OPT_BIT('s', "stat-only", &flags, "show statistics only",
			VERIFY_PACK_STAT_ONLY),
		OPT_END()
	};

#ifdef USE_CPLUSPLUS_FOR_INIT
#pragma cplusplus reset
#endif

	git_config(git_default_config, NULL);
	argc = parse_options(argc, argv, prefix, verify_pack_options,
			     verify_pack_usage, 0);
	if (argc < 1)
		usage_with_options(verify_pack_usage, verify_pack_options);
	for (i = 0; i < argc; i++) {
		if (verify_one_pack(argv[i], flags))
			err = 1;
		discard_revindex();
	}

	return err;
}
Exemplo n.º 2
0
int main(int ac, char **av)
{
	int errs = 0;
	int verbose = 0;
	int no_more_options = 0;

	while (1 < ac) {
		char path[PATH_MAX];

		if (!no_more_options && av[1][0] == '-') {
			if (!strcmp("-v", av[1]))
				verbose = 1;
			else if (!strcmp("--", av[1]))
				no_more_options = 1;
			else
				usage(verify_pack_usage);
		}
		else {
			strcpy(path, av[1]);
			if (verify_one_pack(path, verbose))
				errs++;
		}
		ac--; av++;
	}
	return !!errs;
}