fixup: code cleanup around rebase commit signing Use ci_git_fail_with where appropriate. Use correct initializer for callback.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
diff --git a/include/git2/rebase.h b/include/git2/rebase.h
index 394117c..0a3e377 100644
--- a/include/git2/rebase.h
+++ b/include/git2/rebase.h
@@ -134,7 +134,7 @@ typedef enum {
#define GIT_REBASE_OPTIONS_VERSION 1
#define GIT_REBASE_OPTIONS_INIT \
{ GIT_REBASE_OPTIONS_VERSION, 0, 0, NULL, GIT_MERGE_OPTIONS_INIT, \
- GIT_CHECKOUT_OPTIONS_INIT, 0, NULL }
+ GIT_CHECKOUT_OPTIONS_INIT, NULL, NULL }
/** Indicates that a rebase operation is not (yet) in progress. */
#define GIT_REBASE_NO_OPERATION SIZE_MAX
diff --git a/tests/rebase/sign.c b/tests/rebase/sign.c
index 4221676..fa47766 100644
--- a/tests/rebase/sign.c
+++ b/tests/rebase/sign.c
@@ -48,7 +48,6 @@ void test_rebase_sign__passthrough_signing_cb(void)
git_oid commit_id, expected_id;
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
git_commit *commit;
- int error;
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
parent f87d14a4a236582a0278a916340a793714256864\n\
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
@@ -73,8 +72,7 @@ committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n";
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
- cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
- cl_assert_equal_i(GIT_ITEROVER, error);
+ cl_git_fail_with(GIT_ITEROVER, git_rebase_next(&rebase_operation, rebase));
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
@@ -126,7 +124,6 @@ void test_rebase_sign__gpg_with_no_field(void)
git_oid commit_id, expected_id;
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
git_commit *commit;
- int error;
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
parent f87d14a4a236582a0278a916340a793714256864\n\
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
@@ -167,8 +164,7 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
- cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
- cl_assert_equal_i(GIT_ITEROVER, error);
+ cl_git_fail_with(GIT_ITEROVER, git_rebase_next(&rebase_operation, rebase));
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
@@ -211,7 +207,6 @@ void test_rebase_sign__custom_signature_field(void)
git_oid commit_id, expected_id;
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
git_commit *commit;
- int error;
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
parent f87d14a4a236582a0278a916340a793714256864\n\
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
@@ -237,8 +232,7 @@ magicsig magic word: pretty please\n";
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
- cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
- cl_assert_equal_i(GIT_ITEROVER, error);
+ cl_git_fail_with(GIT_ITEROVER, git_rebase_next(&rebase_operation, rebase));
git_reference_free(branch_ref);
git_reference_free(upstream_ref);