| line |
true |
false |
branch |
|
56
|
57 |
0 |
assert(out && tree); |
|
|
0 |
57 |
assert(out && tree); |
|
60
|
54 |
57 |
for (i = 0; i < git_array_size(*parents); i++) { |
|
61
|
54 |
0 |
parent = git_array_get(*parents, i); |
|
68
|
0 |
57 |
if (message_encoding != NULL) |
|
73
|
0 |
57 |
if (git_buf_puts(out, message) < 0) |
|
92
|
6 |
54 |
if (validate && !git_object__is_valid(repo, tree, GIT_OBJECT_TREE)) |
|
|
0 |
6 |
if (validate && !git_object__is_valid(repo, tree, GIT_OBJECT_TREE)) |
|
96
|
57 |
60 |
while ((parent = parent_cb(i, parent_payload)) != NULL) { |
|
97
|
6 |
51 |
if (validate && !git_object__is_valid(repo, parent, GIT_OBJECT_COMMIT)) { |
|
|
0 |
6 |
if (validate && !git_object__is_valid(repo, parent, GIT_OBJECT_COMMIT)) { |
|
102
|
48 |
9 |
parent_cpy = git_array_alloc(*parents); |
|
|
9 |
0 |
parent_cpy = git_array_alloc(*parents); |
|
103
|
0 |
57 |
GIT_ERROR_CHECK_ALLOC(parent_cpy); |
|
109
|
26 |
34 |
if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) { |
|
|
26 |
0 |
if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) { |
|
|
26 |
0 |
if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) { |
|
|
0 |
26 |
if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) { |
|
142
|
30 |
24 |
if (update_ref) { |
|
144
|
4 |
26 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
4 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
149
|
26 |
28 |
if (ref) |
|
152
|
0 |
54 |
if ((error = validate_tree_and_parents(&parents, repo, tree, parent_cb, parent_payload, current_id, validate)) < 0) |
|
159
|
0 |
54 |
if (error < 0) |
|
162
|
0 |
54 |
if (git_repository_odb__weakptr(&odb, repo) < 0) |
|
165
|
0 |
54 |
if (git_odb__freshen(odb, tree) < 0) |
|
168
|
0 |
54 |
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJECT_COMMIT) < 0) |
|
172
|
30 |
24 |
if (update_ref != NULL) { |
|
211
|
0 |
0 |
if (curr >= data->total) |
|
213
|
0 |
0 |
commit = va_arg(data->args, const git_commit *); |
|
214
|
0 |
0 |
return commit ? git_commit_id(commit) : NULL; |
|
232
|
0 |
0 |
assert(tree && git_tree_owner(tree) == repo); |
|
|
0 |
0 |
assert(tree && git_tree_owner(tree) == repo); |
|
254
|
0 |
0 |
return (curr < data->total) ? data->parents[curr] : NULL; |
|
287
|
57 |
54 |
if (curr >= data->total) |
|
290
|
0 |
54 |
if (git_commit_owner(commit) != data->repo) |
|
309
|
54 |
0 |
assert(tree && git_tree_owner(tree) == repo); |
|
|
0 |
54 |
assert(tree && git_tree_owner(tree) == repo); |
|
320
|
0 |
0 |
if (curr >= git_array_size(commit_to_amend->parent_ids)) |
|
322
|
0 |
0 |
return git_array_get(commit_to_amend->parent_ids, curr); |
|
340
|
0 |
0 |
assert(id && commit_to_amend); |
|
|
0 |
0 |
assert(id && commit_to_amend); |
|
344
|
0 |
0 |
if (!author) |
|
346
|
0 |
0 |
if (!committer) |
|
348
|
0 |
0 |
if (!message_encoding) |
|
350
|
0 |
0 |
if (!message) |
|
353
|
0 |
0 |
if (!tree) { |
|
355
|
0 |
0 |
GIT_ERROR_CHECK_ERROR( git_commit_tree(&old_tree, commit_to_amend) ); |
|
359
|
0 |
0 |
assert(git_tree_owner(tree) == repo); |
|
363
|
0 |
0 |
if (update_ref) { |
|
364
|
0 |
0 |
if ((error = git_reference_lookup_resolved(&ref, repo, update_ref, 5)) < 0) |
|
367
|
0 |
0 |
if (git_oid_cmp(git_commit_id(commit_to_amend), git_reference_target(ref))) { |
|
378
|
0 |
0 |
if (!error && update_ref) { |
|
|
0 |
0 |
if (!error && update_ref) { |
|
395
|
268 |
0 |
assert(commit && data); |
|
|
0 |
268 |
assert(commit && data); |
|
401
|
0 |
268 |
GIT_ERROR_CHECK_ARRAY(commit->parent_ids); |
|
404
|
90 |
178 |
if (!(flags & GIT_COMMIT_PARSE_QUICK)) { |
|
405
|
0 |
90 |
if (git_oid__parse(&commit->tree_id, &buffer, buffer_end, "tree ") < 0) |
|
409
|
0 |
178 |
if (buffer + tree_len > buffer_end) |
|
418
|
227 |
268 |
while (git_oid__parse(&parent_id, &buffer, buffer_end, "parent ") == 0) { |
|
419
|
28 |
199 |
git_oid *new_id = git_array_alloc(commit->parent_ids); |
|
|
199 |
0 |
git_oid *new_id = git_array_alloc(commit->parent_ids); |
|
420
|
0 |
227 |
GIT_ERROR_CHECK_ALLOC(new_id); |
|
425
|
90 |
178 |
if (!(flags & GIT_COMMIT_PARSE_QUICK)) { |
|
427
|
0 |
90 |
GIT_ERROR_CHECK_ALLOC(commit->author); |
|
429
|
0 |
90 |
if (git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n') < 0) |
|
434
|
178 |
268 |
while (!git__prefixncmp(buffer, buffer_end - buffer, "author ")) { |
|
435
|
0 |
178 |
if (git_signature__parse(&dummy_sig, &buffer, buffer_end, "author ", '\n') < 0) |
|
444
|
0 |
268 |
GIT_ERROR_CHECK_ALLOC(commit->committer); |
|
446
|
0 |
268 |
if (git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n') < 0) |
|
449
|
178 |
90 |
if (flags & GIT_COMMIT_PARSE_QUICK) |
|
453
|
90 |
0 |
while (buffer < buffer_end) { |
|
455
|
90 |
0 |
if (buffer[-1] == '\n' && buffer[0] == '\n') |
|
|
90 |
0 |
if (buffer[-1] == '\n' && buffer[0] == '\n') |
|
458
|
0 |
0 |
while (eoln < buffer_end && *eoln != '\n') |
|
|
0 |
0 |
while (eoln < buffer_end && *eoln != '\n') |
|
461
|
0 |
0 |
if (git__prefixncmp(buffer, buffer_end - buffer, "encoding ") == 0) { |
|
465
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(commit->message_encoding); |
|
468
|
0 |
0 |
if (eoln < buffer_end && *eoln == '\n') |
|
|
0 |
0 |
if (eoln < buffer_end && *eoln == '\n') |
|
475
|
0 |
90 |
GIT_ERROR_CHECK_ALLOC(commit->raw_header); |
|
481
|
90 |
0 |
if (buffer <= buffer_end) |
|
485
|
0 |
90 |
GIT_ERROR_CHECK_ALLOC(commit->raw_message); |
|
516
|
0 |
33 |
GIT_COMMIT_GETTER(const git_signature *, author, commit->author) |
|
517
|
0 |
60 |
GIT_COMMIT_GETTER(const git_signature *, committer, commit->committer) |
|
518
|
0 |
0 |
GIT_COMMIT_GETTER(const char *, message_raw, commit->raw_message) |
|
519
|
0 |
3 |
GIT_COMMIT_GETTER(const char *, message_encoding, commit->message_encoding) |
|
520
|
0 |
0 |
GIT_COMMIT_GETTER(const char *, raw_header, commit->raw_header) |
|
521
|
0 |
3 |
GIT_COMMIT_GETTER(git_time_t, time, commit->committer->when.time) |
|
522
|
0 |
3 |
GIT_COMMIT_GETTER(int, time_offset, commit->committer->when.offset) |
|
523
|
0 |
86 |
GIT_COMMIT_GETTER(unsigned int, parentcount, (unsigned int)git_array_size(commit->parent_ids)) |
|
524
|
0 |
13 |
GIT_COMMIT_GETTER(const git_oid *, tree_id, &commit->tree_id) |
|
530
|
0 |
76 |
assert(commit); |
|
535
|
76 |
0 |
while (*message && *message == '\n') |
|
|
0 |
76 |
while (*message && *message == '\n') |
|
547
|
0 |
77 |
assert(commit); |
|
549
|
37 |
40 |
if (!commit->summary) { |
|
550
|
582 |
1 |
for (msg = git_commit_message(commit), space = NULL; *msg; ++msg) { |
|
553
|
36 |
546 |
if (next_character == '\n' && (!msg[1] || msg[1] == '\n')) |
|
|
7 |
29 |
if (next_character == '\n' && (!msg[1] || msg[1] == '\n')) |
|
|
0 |
7 |
if (next_character == '\n' && (!msg[1] || msg[1] == '\n')) |
|
556
|
51 |
495 |
else if (git__isspace(next_character)) { |
|
557
|
51 |
0 |
if(space == NULL) { |
|
566
|
51 |
444 |
if (space) { |
|
567
|
0 |
51 |
if(space_contains_newline) |
|
579
|
0 |
37 |
if (!commit->summary) |
|
590
|
0 |
4 |
assert(commit); |
|
592
|
4 |
0 |
if (!commit->body) { |
|
594
|
55 |
0 |
for (msg = git_commit_message(commit); *msg; ++msg) |
|
595
|
4 |
51 |
if (msg[0] == '\n' && (!msg[1] || msg[1] == '\n')) |
|
|
1 |
3 |
if (msg[0] == '\n' && (!msg[1] || msg[1] == '\n')) |
|
|
0 |
1 |
if (msg[0] == '\n' && (!msg[1] || msg[1] == '\n')) |
|
599
|
7 |
3 |
for (; *msg; ++msg) |
|
600
|
1 |
6 |
if (!git__isspace(*msg)) |
|
602
|
2 |
3 |
for (end = msg + strlen(msg) - 1; msg <= end; --end) |
|
603
|
1 |
1 |
if (!git__isspace(*end)) |
|
606
|
1 |
3 |
if (*msg) |
|
615
|
0 |
305 |
assert(commit); |
|
622
|
0 |
40 |
assert(commit); |
|
624
|
39 |
1 |
return git_array_get(commit->parent_ids, n); |
|
631
|
0 |
40 |
assert(commit); |
|
634
|
1 |
39 |
if (parent_id == NULL) { |
|
650
|
10 |
0 |
assert(ancestor && commit); |
|
|
0 |
10 |
assert(ancestor && commit); |
|
652
|
0 |
10 |
if (git_commit_dup(¤t, (git_commit *)commit) < 0) |
|
655
|
2 |
8 |
if (n == 0) { |
|
660
|
11 |
7 |
while (n--) { |
|
665
|
1 |
10 |
if (error < 0) |
|
681
|
0 |
0 |
while ((eol = strchr(buf, '\n'))) { |
|
683
|
0 |
0 |
if (buf[0] == ' ') { |
|
689
|
0 |
0 |
if (git__prefixcmp(buf, field)) { |
|
696
|
0 |
0 |
if (buf[0] != ' ') { |
|
704
|
0 |
0 |
if (git_buf_oom(out)) |
|
708
|
0 |
0 |
while (eol[1] == ' ') { |
|
712
|
0 |
0 |
if (!eol) |
|
718
|
0 |
0 |
if (git_buf_oom(out)) |
|
746
|
0 |
0 |
if (!field) |
|
749
|
0 |
0 |
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0) |
|
752
|
0 |
0 |
if ((error = git_odb_read(&obj, odb, commit_id)) < 0) |
|
755
|
0 |
0 |
if (obj->cached.type != GIT_OBJECT_COMMIT) { |
|
763
|
0 |
0 |
while ((h = strchr(buf, '\n')) && h[1] != '\0') { |
|
|
0 |
0 |
while ((h = strchr(buf, '\n')) && h[1] != '\0') { |
|
765
|
0 |
0 |
if (git__prefixcmp(buf, field)) { |
|
766
|
0 |
0 |
if (git_buf_put(signed_data, buf, h - buf) < 0) |
|
776
|
0 |
0 |
if (h[0] != ' ') { |
|
780
|
0 |
0 |
if (!eol) |
|
786
|
0 |
0 |
if (git_buf_oom(signature)) |
|
790
|
0 |
0 |
while (eol[1] == ' ') { |
|
794
|
0 |
0 |
if (!eol) |
|
800
|
0 |
0 |
if (git_buf_oom(signature)) |
|
843
|
3 |
0 |
assert(tree && git_tree_owner(tree) == repo); |
|
|
0 |
3 |
assert(tree && git_tree_owner(tree) == repo); |
|
847
|
0 |
3 |
if ((error = validate_tree_and_parents(&parents_arr, repo, tree_id, commit_parent_from_array, &data, NULL, true)) < 0) |
|
866
|
0 |
0 |
assert(out && field && content); |
|
|
0 |
0 |
assert(out && field && content); |
|
|
0 |
0 |
assert(out && field && content); |
|
871
|
0 |
0 |
while ((lf = strchr(content, '\n')) != NULL) { |
|
885
|
3 |
3 |
return git_array_get(commit->parent_ids, n); |
|
906
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC(parsed); |
|
907
|
0 |
3 |
if ((error = commit_parse(parsed, commit_content, strlen(commit_content), 0)) < 0) |
|
910
|
0 |
3 |
if ((error = validate_tree_and_parents(&parents, repo, &parsed->tree_id, commit_parent_from_commit, parsed, NULL, true)) < 0) |
|
917
|
0 |
3 |
if (!header_end) { |
|
927
|
0 |
3 |
if (signature != NULL) { |
|
928
|
0 |
0 |
field = signature_field ? signature_field : "gpgsig"; |
|
934
|
0 |
3 |
if (git_buf_oom(&commit)) |
|
937
|
0 |
3 |
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0) |
|
940
|
0 |
3 |
if ((error = git_odb_write(out, odb, commit.ptr, commit.size, GIT_OBJECT_COMMIT)) < 0) |