Skip to content

Commit 3a8ef82

Browse files
committed
Update formatting of newly added rebase sign test suite
1 parent 578cc02 commit 3a8ef82

File tree

1 file changed

+124
-124
lines changed

1 file changed

+124
-124
lines changed

tests/rebase/sign.c

Lines changed: 124 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ static git_signature *signature;
77
/* Fixture setup and teardown */
88
void test_rebase_sign__initialize(void)
99
{
10-
repo = cl_git_sandbox_init("rebase");
11-
cl_git_pass(git_signature_new(&signature, "Rebaser",
10+
repo = cl_git_sandbox_init("rebase");
11+
cl_git_pass(git_signature_new(&signature, "Rebaser",
1212
"rebaser@rebaser.rb", 1405694510, 0));
1313
}
1414

@@ -26,71 +26,71 @@ committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n\
2626
Modification 3 to gravy\n";
2727

2828
int signature_cb_passthrough(
29-
git_buf *signature,
30-
git_buf *signature_field,
31-
const char *commit_content,
32-
void *payload)
29+
git_buf *signature,
30+
git_buf *signature_field,
31+
const char *commit_content,
32+
void *payload)
3333
{
34-
cl_assert_equal_b(false, git_buf_is_allocated(signature));
35-
cl_assert_equal_b(false, git_buf_is_allocated(signature_field));
36-
cl_assert_equal_s(expected_commit_content, commit_content);
37-
cl_assert_equal_p(NULL, payload);
38-
return GIT_PASSTHROUGH;
34+
cl_assert_equal_b(false, git_buf_is_allocated(signature));
35+
cl_assert_equal_b(false, git_buf_is_allocated(signature_field));
36+
cl_assert_equal_s(expected_commit_content, commit_content);
37+
cl_assert_equal_p(NULL, payload);
38+
return GIT_PASSTHROUGH;
3939
}
4040

4141
/* git checkout gravy ; git rebase --merge veal */
4242
void test_rebase_sign__passthrough_signature_cb(void)
4343
{
44-
git_rebase *rebase;
45-
git_reference *branch_ref, *upstream_ref;
46-
git_annotated_commit *branch_head, *upstream_head;
47-
git_rebase_operation *rebase_operation;
48-
git_oid commit_id, expected_id;
49-
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
50-
git_commit *commit;
51-
int error;
52-
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
44+
git_rebase *rebase;
45+
git_reference *branch_ref, *upstream_ref;
46+
git_annotated_commit *branch_head, *upstream_head;
47+
git_rebase_operation *rebase_operation;
48+
git_oid commit_id, expected_id;
49+
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
50+
git_commit *commit;
51+
int error;
52+
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
5353
parent f87d14a4a236582a0278a916340a793714256864\n\
5454
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
5555
committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n";
5656

57-
rebase_opts.signature_cb = signature_cb_passthrough;
57+
rebase_opts.signature_cb = signature_cb_passthrough;
5858

59-
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
60-
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
59+
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
60+
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
6161

62-
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
63-
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
62+
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
63+
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
6464

65-
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_opts));
65+
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_opts));
6666

67-
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
68-
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
67+
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
68+
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
6969

70-
git_oid_fromstr(&expected_id, "129183968a65abd6c52da35bff43325001bfc630");
71-
cl_assert_equal_oid(&expected_id, &commit_id);
70+
git_oid_fromstr(&expected_id, "129183968a65abd6c52da35bff43325001bfc630");
71+
cl_assert_equal_oid(&expected_id, &commit_id);
7272

73-
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
74-
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
73+
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
74+
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
7575

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

79-
git_reference_free(branch_ref);
80-
git_reference_free(upstream_ref);
81-
git_annotated_commit_free(branch_head);
82-
git_annotated_commit_free(upstream_head);
83-
git_commit_free(commit);
84-
git_rebase_free(rebase);
79+
git_reference_free(branch_ref);
80+
git_reference_free(upstream_ref);
81+
git_annotated_commit_free(branch_head);
82+
git_annotated_commit_free(upstream_head);
83+
git_commit_free(commit);
84+
git_rebase_free(rebase);
8585
}
8686

8787
int signature_cb_gpg(
88-
git_buf *signature,
89-
git_buf *signature_field,
90-
const char *commit_content,
91-
void *payload)
88+
git_buf *signature,
89+
git_buf *signature_field,
90+
const char *commit_content,
91+
void *payload)
9292
{
93-
const char *gpg_signature = "-----BEGIN PGP SIGNATURE-----\n\
93+
const char *gpg_signature = "-----BEGIN PGP SIGNATURE-----\n\
9494
\n\
9595
iQIzBAEBCgAdFiEEgVlDEfSlmKn0fvGgK++h5T2/ctIFAlwZcrAACgkQK++h5T2/\n\
9696
ctIPVhAA42RyZhMdKl5Bm0KtQco2scsukIg2y7tjSwhti91zDu3HQgpusjjo0fQx\n\
@@ -107,27 +107,27 @@ cttVRsdOoego+fiy08eFE+aJIeYiINRGhqOBTsuqG4jIdpdKxPE=\n\
107107
=KbsY\n\
108108
-----END PGP SIGNATURE-----";
109109

110-
cl_assert_equal_b(false, git_buf_is_allocated(signature));
111-
cl_assert_equal_b(false, git_buf_is_allocated(signature_field));
112-
cl_assert_equal_s(expected_commit_content, commit_content);
113-
cl_assert_equal_p(NULL, payload);
110+
cl_assert_equal_b(false, git_buf_is_allocated(signature));
111+
cl_assert_equal_b(false, git_buf_is_allocated(signature_field));
112+
cl_assert_equal_s(expected_commit_content, commit_content);
113+
cl_assert_equal_p(NULL, payload);
114114

115-
cl_git_pass(git_buf_set(signature, gpg_signature, strlen(gpg_signature) + 1));
116-
return GIT_OK;
115+
cl_git_pass(git_buf_set(signature, gpg_signature, strlen(gpg_signature) + 1));
116+
return GIT_OK;
117117
}
118118

119119
/* git checkout gravy ; git rebase --merge veal */
120120
void test_rebase_sign__gpg_with_no_field(void)
121121
{
122-
git_rebase *rebase;
123-
git_reference *branch_ref, *upstream_ref;
124-
git_annotated_commit *branch_head, *upstream_head;
125-
git_rebase_operation *rebase_operation;
126-
git_oid commit_id, expected_id;
127-
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
128-
git_commit *commit;
129-
int error;
130-
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
122+
git_rebase *rebase;
123+
git_reference *branch_ref, *upstream_ref;
124+
git_annotated_commit *branch_head, *upstream_head;
125+
git_rebase_operation *rebase_operation;
126+
git_oid commit_id, expected_id;
127+
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
128+
git_commit *commit;
129+
int error;
130+
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
131131
parent f87d14a4a236582a0278a916340a793714256864\n\
132132
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
133133
committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n\
@@ -148,102 +148,102 @@ gpgsig -----BEGIN PGP SIGNATURE-----\n\
148148
=KbsY\n\
149149
-----END PGP SIGNATURE-----\n";
150150

151-
rebase_opts.signature_cb = signature_cb_gpg;
151+
rebase_opts.signature_cb = signature_cb_gpg;
152152

153-
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
154-
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
153+
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
154+
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
155155

156-
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
157-
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
156+
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
157+
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
158158

159-
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_opts));
159+
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_opts));
160160

161-
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
162-
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
161+
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
162+
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
163163

164-
git_oid_fromstr(&expected_id, "bf78348e45c8286f52b760f1db15cb6da030f2ef");
165-
cl_assert_equal_oid(&expected_id, &commit_id);
164+
git_oid_fromstr(&expected_id, "bf78348e45c8286f52b760f1db15cb6da030f2ef");
165+
cl_assert_equal_oid(&expected_id, &commit_id);
166166

167-
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
168-
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
167+
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
168+
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
169169

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

173-
git_reference_free(branch_ref);
174-
git_reference_free(upstream_ref);
175-
git_annotated_commit_free(branch_head);
176-
git_annotated_commit_free(upstream_head);
177-
git_commit_free(commit);
178-
git_rebase_free(rebase);
173+
git_reference_free(branch_ref);
174+
git_reference_free(upstream_ref);
175+
git_annotated_commit_free(branch_head);
176+
git_annotated_commit_free(upstream_head);
177+
git_commit_free(commit);
178+
git_rebase_free(rebase);
179179
}
180180

181181

182182
int signature_cb_magic_field(
183-
git_buf *signature,
184-
git_buf *signature_field,
185-
const char *commit_content,
186-
void *payload)
183+
git_buf *signature,
184+
git_buf *signature_field,
185+
const char *commit_content,
186+
void *payload)
187187
{
188-
const char *signature_content = "magic word: pretty please";
189-
const char * signature_field_content = "magicsig";
188+
const char *signature_content = "magic word: pretty please";
189+
const char * signature_field_content = "magicsig";
190190

191-
cl_assert_equal_b(false, git_buf_is_allocated(signature));
192-
cl_assert_equal_b(false, git_buf_is_allocated(signature_field));
193-
cl_assert_equal_s(expected_commit_content, commit_content);
194-
cl_assert_equal_p(NULL, payload);
191+
cl_assert_equal_b(false, git_buf_is_allocated(signature));
192+
cl_assert_equal_b(false, git_buf_is_allocated(signature_field));
193+
cl_assert_equal_s(expected_commit_content, commit_content);
194+
cl_assert_equal_p(NULL, payload);
195195

196-
cl_git_pass(git_buf_set(signature, signature_content,
197-
strlen(signature_content) + 1));
198-
cl_git_pass(git_buf_set(signature_field, signature_field_content,
199-
strlen(signature_field_content) + 1));
196+
cl_git_pass(git_buf_set(signature, signature_content,
197+
strlen(signature_content) + 1));
198+
cl_git_pass(git_buf_set(signature_field, signature_field_content,
199+
strlen(signature_field_content) + 1));
200200

201-
return GIT_OK;
201+
return GIT_OK;
202202
}
203203

204204
/* git checkout gravy ; git rebase --merge veal */
205205
void test_rebase_sign__custom_signature_field(void)
206206
{
207-
git_rebase *rebase;
208-
git_reference *branch_ref, *upstream_ref;
209-
git_annotated_commit *branch_head, *upstream_head;
210-
git_rebase_operation *rebase_operation;
211-
git_oid commit_id, expected_id;
212-
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
213-
git_commit *commit;
214-
int error;
215-
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
207+
git_rebase *rebase;
208+
git_reference *branch_ref, *upstream_ref;
209+
git_annotated_commit *branch_head, *upstream_head;
210+
git_rebase_operation *rebase_operation;
211+
git_oid commit_id, expected_id;
212+
git_rebase_options rebase_opts = GIT_REBASE_OPTIONS_INIT;
213+
git_commit *commit;
214+
int error;
215+
const char *expected_commit_raw_header = "tree cd99b26250099fc38d30bfaed7797a7275ed3366\n\
216216
parent f87d14a4a236582a0278a916340a793714256864\n\
217217
author Edward Thomson <ethomson@edwardthomson.com> 1405625055 -0400\n\
218218
committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n\
219219
magicsig magic word: pretty please\n";
220220

221-
rebase_opts.signature_cb = signature_cb_magic_field;
221+
rebase_opts.signature_cb = signature_cb_magic_field;
222222

223-
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
224-
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
223+
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/gravy"));
224+
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/veal"));
225225

226-
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
227-
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
226+
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
227+
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
228228

229-
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_opts));
229+
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_opts));
230230

231-
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
232-
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
231+
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
232+
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, NULL, NULL));
233233

234-
git_oid_fromstr(&expected_id, "f46a4a8d26ae411b02aa61b7d69576627f4a1e1c");
235-
cl_assert_equal_oid(&expected_id, &commit_id);
234+
git_oid_fromstr(&expected_id, "f46a4a8d26ae411b02aa61b7d69576627f4a1e1c");
235+
cl_assert_equal_oid(&expected_id, &commit_id);
236236

237-
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
238-
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
237+
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
238+
cl_assert_equal_s(expected_commit_raw_header, git_commit_raw_header(commit));
239239

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

243-
git_reference_free(branch_ref);
244-
git_reference_free(upstream_ref);
245-
git_annotated_commit_free(branch_head);
246-
git_annotated_commit_free(upstream_head);
247-
git_commit_free(commit);
248-
git_rebase_free(rebase);
243+
git_reference_free(branch_ref);
244+
git_reference_free(upstream_ref);
245+
git_annotated_commit_free(branch_head);
246+
git_annotated_commit_free(upstream_head);
247+
git_commit_free(commit);
248+
git_rebase_free(rebase);
249249
}

0 commit comments

Comments
 (0)