| line |
true |
false |
branch |
|
22
|
1 |
8 |
if (git_oid_fromstrn(&oid, spec, speclen) < 0) |
|
32
|
16 |
8 |
if (speclen != GIT_OID_HEXSZ) |
|
49
|
0 |
0 |
if (*pattern == '\0') { |
|
55
|
0 |
0 |
if (!error) |
|
71
|
2 |
0 |
if (substr == NULL) |
|
74
|
0 |
0 |
if (build_regex(®ex, ".+-[0-9]+-g[0-9a-fA-F]+") < 0) |
|
80
|
0 |
0 |
if (error) |
|
95
|
8 |
16 |
if ((error = maybe_sha(object_out, repo, spec)) != GIT_ENOTFOUND) |
|
99
|
14 |
2 |
if (!error) { |
|
104
|
14 |
0 |
if (!error) |
|
110
|
0 |
2 |
if (error != GIT_ENOTFOUND) |
|
113
|
1 |
1 |
if ((strlen(spec) < GIT_OID_HEXSZ) && |
|
|
0 |
1 |
if ((strlen(spec) < GIT_OID_HEXSZ) && |
|
117
|
0 |
2 |
if ((error = maybe_describe(object_out, repo, spec)) != GIT_ENOTFOUND) |
|
129
|
0 |
2 |
if (git__strntol32(&content, curly_braces_content, strlen(curly_braces_content), |
|
133
|
0 |
2 |
if (*end_ptr != '\0') |
|
153
|
0 |
0 |
if (*identifier != '\0' || *base_ref != NULL) |
|
|
0 |
0 |
if (*identifier != '\0' || *base_ref != NULL) |
|
156
|
0 |
0 |
if (build_regex(&preg, "checkout: moving from (.*) to .*") < 0) |
|
159
|
0 |
0 |
if (git_reference_lookup(&ref, repo, GIT_HEAD_FILE) < 0) |
|
162
|
0 |
0 |
if (git_reflog_read(&reflog, repo, GIT_HEAD_FILE) < 0) |
|
167
|
0 |
0 |
for (i = 0; i < numentries; i++) { |
|
172
|
0 |
0 |
if (!msg) |
|
175
|
0 |
0 |
if (git_regexp_search(&preg, msg, 2, regexmatches) < 0) |
|
180
|
0 |
0 |
if (cur > 0) |
|
183
|
0 |
0 |
if ((git_str_put(&buf, msg+regexmatches[1].start, regexmatches[1].end - regexmatches[1].start)) < 0) |
|
186
|
0 |
0 |
if ((error = git_reference_dwim(base_ref, repo, git_str_cstr(&buf))) == 0) |
|
189
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
214
|
0 |
2 |
if (git_reflog_read(&reflog, git_reference_owner(ref), git_reference_name(ref)) < 0) |
|
219
|
2 |
0 |
if (search_by_pos) { |
|
220
|
0 |
2 |
if (numentries < identifier + 1) |
|
229
|
0 |
0 |
for (i = 0; i < numentries; i++) { |
|
233
|
0 |
0 |
if (commit_time.time > (git_time_t)identifier) |
|
240
|
0 |
0 |
if (i == numentries) { |
|
241
|
0 |
0 |
if (entry == NULL) |
|
270
|
2 |
0 |
if (*base_ref == NULL) { |
|
271
|
0 |
2 |
if ((error = git_reference_dwim(&ref, repo, identifier)) < 0) |
|
278
|
0 |
2 |
if (position == 0) { |
|
283
|
0 |
2 |
if ((error = retrieve_oid_from_reflog(&oid, ref, position)) < 0) |
|
298
|
0 |
0 |
if (*base_ref == NULL) { |
|
299
|
0 |
0 |
if ((error = git_reference_dwim(&ref, repo, identifier)) < 0) |
|
306
|
0 |
0 |
if (!git_reference_is_branch(ref)) { |
|
311
|
0 |
0 |
if ((error = git_branch_upstream(&tracking, ref)) < 0) |
|
328
|
0 |
2 |
GIT_ASSERT(*out == NULL); |
|
330
|
0 |
2 |
if (git_str_put(&identifier, spec, identifier_len) < 0) |
|
335
|
0 |
2 |
if (*curly_braces_content == '-' && (!is_numeric || parsed == 0)) { |
|
|
0 |
0 |
if (*curly_braces_content == '-' && (!is_numeric || parsed == 0)) { |
|
|
0 |
0 |
if (*curly_braces_content == '-' && (!is_numeric || parsed == 0)) { |
|
340
|
2 |
0 |
if (is_numeric) { |
|
341
|
0 |
2 |
if (parsed < 0) |
|
349
|
0 |
0 |
if (!strcmp(curly_braces_content, "u") || !strcmp(curly_braces_content, "upstream")) { |
|
|
0 |
0 |
if (!strcmp(curly_braces_content, "u") || !strcmp(curly_braces_content, "upstream")) { |
|
355
|
0 |
0 |
if (git_date_parse(×tamp, curly_braces_content) < 0) { |
|
369
|
0 |
0 |
if (!strcmp(str, "commit")) |
|
372
|
0 |
0 |
if (!strcmp(str, "tree")) |
|
375
|
0 |
0 |
if (!strcmp(str, "blob")) |
|
378
|
0 |
0 |
if (!strcmp(str, "tag")) |
|
386
|
0 |
0 |
if (git_object_type(obj) == GIT_OBJECT_TAG) |
|
397
|
0 |
0 |
if ((error = git_object_peel(&temp_commit, obj, GIT_OBJECT_COMMIT)) < 0) |
|
398
|
0 |
0 |
return (error == GIT_EAMBIGUOUS || error == GIT_ENOTFOUND) ? |
|
399
|
0 |
0 |
GIT_EINVALIDSPEC : error; |
|
401
|
0 |
0 |
if (n == 0) { |
|
417
|
0 |
4 |
if ((error = git_object_peel(&temp_commit, obj, GIT_OBJECT_COMMIT)) < 0) |
|
418
|
0 |
0 |
return (error == GIT_EAMBIGUOUS || error == GIT_ENOTFOUND) ? |
|
419
|
0 |
0 |
GIT_EINVALIDSPEC : error; |
|
436
|
0 |
0 |
if ((error = git_object_peel(&tree, obj, GIT_OBJECT_TREE)) < 0) |
|
437
|
0 |
0 |
return error == GIT_ENOTFOUND ? GIT_EINVALIDSPEC : error; |
|
439
|
0 |
0 |
if (*path == '\0') { |
|
448
|
0 |
0 |
if ((error = git_tree_entry_bypath(&entry, (git_tree *)tree, path)) < 0) |
|
466
|
0 |
0 |
while (!(error = git_revwalk_next(&oid, walk))) { |
|
469
|
0 |
0 |
if ((error < 0) && (error != GIT_ENOTFOUND)) |
|
|
0 |
0 |
if ((error < 0) && (error != GIT_ENOTFOUND)) |
|
472
|
0 |
0 |
if (!git_regexp_match(regex, git_commit_message((git_commit*)obj))) { |
|
480
|
0 |
0 |
if (error < 0 && error == GIT_ITEROVER) |
|
|
0 |
0 |
if (error < 0 && error == GIT_ITEROVER) |
|
492
|
0 |
0 |
if ((error = build_regex(&preg, pattern)) < 0) |
|
495
|
0 |
0 |
if ((error = git_revwalk_new(&walk, repo)) < 0) |
|
500
|
0 |
0 |
if (spec_oid == NULL) { |
|
501
|
0 |
0 |
if ((error = git_revwalk_push_glob(walk, "refs/*")) < 0) |
|
503
|
0 |
0 |
} else if ((error = git_revwalk_push(walk, spec_oid)) < 0) |
|
519
|
0 |
0 |
if (*curly_braces_content == '\0') |
|
522
|
0 |
0 |
if (*curly_braces_content == '/') |
|
527
|
0 |
0 |
if (expected_type == GIT_OBJECT_INVALID) |
|
537
|
2 |
0 |
GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '@'); |
|
|
0 |
2 |
GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '@'); |
|
541
|
2 |
0 |
if (spec[*pos] == '\0' || spec[*pos] != '{') |
|
|
0 |
2 |
if (spec[*pos] == '\0' || spec[*pos] != '{') |
|
546
|
2 |
2 |
while (spec[*pos] != '}') { |
|
547
|
0 |
2 |
if (spec[*pos] == '\0') |
|
550
|
0 |
2 |
if (git_str_putc(buf, spec[(*pos)++]) < 0) |
|
563
|
0 |
0 |
GIT_ASSERT_ARG(spec[*pos] == ':'); |
|
567
|
0 |
0 |
if (git_str_puts(buf, spec + *pos) < 0) |
|
581
|
4 |
0 |
GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '~'); |
|
|
0 |
4 |
GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '~'); |
|
589
|
0 |
4 |
} while (spec[(*pos)] == kind && kind == '~'); |
|
|
0 |
0 |
} while (spec[(*pos)] == kind && kind == '~'); |
|
591
|
0 |
4 |
if (git__isdigit(spec[*pos])) { |
|
592
|
0 |
0 |
if (git__strntol32(&parsed, spec + *pos, strlen(spec + *pos), &end_ptr, 10) < 0) |
|
599
|
0 |
4 |
} while (spec[(*pos)] == kind && kind == '~'); |
|
|
0 |
0 |
} while (spec[(*pos)] == kind && kind == '~'); |
|
611
|
0 |
0 |
if (git_reference_resolve(&resolved, reference) < 0) |
|
625
|
6 |
24 |
if (*object != NULL) |
|
628
|
0 |
24 |
if (*reference != NULL) |
|
631
|
24 |
0 |
if (!allow_empty_identifier && identifier_len == 0) |
|
|
0 |
24 |
if (!allow_empty_identifier && identifier_len == 0) |
|
634
|
0 |
24 |
if (git_str_put(&identifier, spec, identifier_len) < 0) |
|
645
|
496 |
0 |
if (object == NULL) |
|
653
|
0 |
0 |
if (object != NULL) |
|
656
|
0 |
0 |
if (reference != NULL) |
|
659
|
0 |
0 |
if (identifier_len > 0) |
|
667
|
494 |
0 |
if (!ensure_base_rev_is_not_known_yet(object) && reference == NULL) |
|
|
494 |
0 |
if (!ensure_base_rev_is_not_known_yet(object) && reference == NULL) |
|
689
|
0 |
26 |
GIT_ASSERT_ARG(object_out); |
|
690
|
0 |
26 |
GIT_ASSERT_ARG(reference_out); |
|
691
|
0 |
26 |
GIT_ASSERT_ARG(repo); |
|
692
|
0 |
26 |
GIT_ASSERT_ARG(spec); |
|
697
|
500 |
26 |
while (spec[pos]) { |
|
702
|
0 |
0 |
if ((error = ensure_base_rev_loaded(&base_rev, &reference, spec, identifier_len, repo, false)) < 0) |
|
705
|
0 |
0 |
if (spec[pos+1] == '{') { |
|
708
|
0 |
0 |
if ((error = extract_curly_braces_content(&buf, spec, &pos)) < 0) |
|
711
|
0 |
0 |
if ((error = handle_caret_curly_syntax(&temp_object, base_rev, git_str_cstr(&buf))) < 0) |
|
719
|
0 |
0 |
if ((error = extract_how_many(&n, spec, &pos)) < 0) |
|
722
|
0 |
0 |
if ((error = handle_caret_parent_syntax(&temp_object, base_rev, n)) < 0) |
|
736
|
0 |
4 |
if ((error = extract_how_many(&n, spec, &pos)) < 0) |
|
739
|
0 |
4 |
if ((error = ensure_base_rev_loaded(&base_rev, &reference, spec, identifier_len, repo, false)) < 0) |
|
742
|
0 |
4 |
if ((error = handle_linear_syntax(&temp_object, base_rev, n)) < 0) |
|
756
|
0 |
0 |
if ((error = extract_path(&buf, spec, &pos)) < 0) |
|
759
|
0 |
0 |
if (any_left_hand_identifier(base_rev, reference, identifier_len)) { |
|
760
|
0 |
0 |
if ((error = ensure_base_rev_loaded(&base_rev, &reference, spec, identifier_len, repo, true)) < 0) |
|
763
|
0 |
0 |
if ((error = handle_colon_syntax(&temp_object, base_rev, git_str_cstr(&buf))) < 0) |
|
766
|
0 |
0 |
if (*git_str_cstr(&buf) == '/') { |
|
767
|
0 |
0 |
if ((error = handle_grep_syntax(&temp_object, repo, NULL, git_str_cstr(&buf) + 1)) < 0) |
|
787
|
2 |
0 |
if (spec[pos+1] == '{') { |
|
790
|
0 |
2 |
if ((error = extract_curly_braces_content(&buf, spec, &pos)) < 0) |
|
793
|
0 |
2 |
if ((error = ensure_base_rev_is_not_known_yet(base_rev)) < 0) |
|
796
|
0 |
2 |
if ((error = handle_at_syntax(&temp_object, &reference, spec, identifier_len, repo, git_str_cstr(&buf))) < 0) |
|
799
|
2 |
0 |
if (temp_object != NULL) |
|
802
|
0 |
0 |
} else if (spec[pos+1] == '\0') { |
|
809
|
0 |
494 |
if ((error = ensure_left_hand_identifier_is_not_known_yet(base_rev, reference)) < 0) |
|
817
|
2 |
24 |
if ((error = ensure_base_rev_loaded(&base_rev, &reference, spec, identifier_len, repo, false)) < 0) |
|
820
|
4 |
20 |
if (!should_return_reference) { |
|
831
|
2 |
24 |
if (error) { |
|
832
|
0 |
2 |
if (error == GIT_EINVALIDSPEC) |
|
855
|
2 |
24 |
if ((error = revparse(&obj, &ref, &identifier_len, repo, spec)) < 0) |
|
878
|
2 |
24 |
if ((error = git_revparse_ext(&obj, &ref, repo, spec)) < 0) |
|
901
|
0 |
16 |
GIT_ASSERT_ARG(revspec); |
|
902
|
0 |
16 |
GIT_ASSERT_ARG(repo); |
|
903
|
0 |
16 |
GIT_ASSERT_ARG(spec); |
|
907
|
8 |
8 |
if ((dotdot = strstr(spec, "..")) != NULL) { |
|
918
|
0 |
8 |
if (!git__strcmp(spec, "..")) { |
|
925
|
2 |
6 |
if (dotdot[2] == '.') { |
|
930
|
8 |
0 |
error = git_revparse_single( |
|
935
|
8 |
0 |
if (!error) { |
|
936
|
8 |
0 |
error = git_revparse_single( |