Skip to content

Commit a5d4237

Browse files
committed
fixup: code cleanup around rebase commit signing
Use ci_git_fail_with where appropriate. Use correct initializer for callback.
1 parent 39bc514 commit a5d4237

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

include/git2/rebase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ typedef enum {
134134
#define GIT_REBASE_OPTIONS_VERSION 1
135135
#define GIT_REBASE_OPTIONS_INIT \
136136
{ GIT_REBASE_OPTIONS_VERSION, 0, 0, NULL, GIT_MERGE_OPTIONS_INIT, \
137-
GIT_CHECKOUT_OPTIONS_INIT, 0, NULL }
137+
GIT_CHECKOUT_OPTIONS_INIT, NULL, NULL }
138138

139139
/** Indicates that a rebase operation is not (yet) in progress. */
140140
#define GIT_REBASE_NO_OPERATION SIZE_MAX

tests/rebase/sign.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ void test_rebase_sign__passthrough_signing_cb(void)
4848
git_oid commit_id, expected_id;
4949
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
5050
git_commit *commit;
51-
int error;
5251
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
5352
parent f87d14a4a236582a0278a916340a793714256864\n\
5453
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
@@ -73,8 +72,7 @@ committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n";
7372
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
7473
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
7574

76-
cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
77-
cl_assert_equal_i(GIT_ITEROVER, error);
75+
cl_git_fail_with(GIT_ITEROVER, git_rebase_next(&rebase_operation, rebase));
7876

7977
git_reference_free(branch_ref);
8078
git_reference_free(upstream_ref);
@@ -126,7 +124,6 @@ void test_rebase_sign__gpg_with_no_field(void)
126124
git_oid commit_id, expected_id;
127125
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
128126
git_commit *commit;
129-
int error;
130127
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
131128
parent f87d14a4a236582a0278a916340a793714256864\n\
132129
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
@@ -167,8 +164,7 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
167164
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
168165
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
169166

170-
cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
171-
cl_assert_equal_i(GIT_ITEROVER, error);
167+
cl_git_fail_with(GIT_ITEROVER, git_rebase_next(&rebase_operation, rebase));
172168

173169
git_reference_free(branch_ref);
174170
git_reference_free(upstream_ref);
@@ -211,7 +207,6 @@ void test_rebase_sign__custom_signature_field(void)
211207
git_oid commit_id, expected_id;
212208
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
213209
git_commit *commit;
214-
int error;
215210
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
216211
parent f87d14a4a236582a0278a916340a793714256864\n\
217212
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
@@ -237,8 +232,7 @@ magicsig magic word: pretty please\n";
237232
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
238233
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
239234

240-
cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
241-
cl_assert_equal_i(GIT_ITEROVER, error);
235+
cl_git_fail_with(GIT_ITEROVER, git_rebase_next(&rebase_operation, rebase));
242236

243237
git_reference_free(branch_ref);
244238
git_reference_free(upstream_ref);

0 commit comments

Comments
 (0)