Exemple #1
0
int cmd_verify_commit(int argc, const char **argv, const char *prefix)
{
	int i = 1, verbose = 0, had_error = 0;
	unsigned flags = 0;
	const struct option verify_commit_options[] = {
		OPT__VERBOSE(&verbose, N_("print commit contents")),
		OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
		OPT_END()
	};

	git_config(git_verify_commit_config, NULL);

	argc = parse_options(argc, argv, prefix, verify_commit_options,
			     verify_commit_usage, PARSE_OPT_KEEP_ARGV0);
	if (argc <= i)
		usage_with_options(verify_commit_usage, verify_commit_options);

	if (verbose)
		flags |= GPG_VERIFY_VERBOSE;

	/* sometimes the program was terminated because this signal
	 * was received in the process of writing the gpg input: */
	signal(SIGPIPE, SIG_IGN);
	while (i < argc)
		if (verify_commit(argv[i++], flags))
			had_error = 1;
	return had_error;
}
static gboolean
commit_verify_cb (EBookTestClosure *closure)
{
	EContact *contact;

	contact = ebook_test_utils_book_get_contact (book, uid);
	verify_commit (contact);

	g_main_loop_quit ((GMainLoop *) (closure->user_data));

	return FALSE;
}
static void
test_commit_contact_sync (ETestServerFixture *fixture,
                          gconstpointer user_data)
{
	EContact *contact;

	book = E_TEST_SERVER_UTILS_SERVICE (fixture, EBook);
	uid = ebook_test_utils_book_add_contact_from_test_case_verify (book, "name-only", &contact);

	verify_precommit_and_prepare_contact (contact);
	ebook_test_utils_book_commit_contact (book, contact);
	verify_commit (contact);

	test_print ("successfully committed changes to contact contact '%s'\n", uid);
	g_object_unref (contact);
	g_free (uid);

	contact = NULL;
	uid = NULL;
}