line |
true |
false |
branch |
40
|
0 |
1270 |
if (!GIT_ADD_SIZET_OVERFLOW(&reflen, sizeof(git_reference), namelen) && |
|
1270 |
0 |
if (!GIT_ADD_SIZET_OVERFLOW(&reflen, sizeof(git_reference), namelen) && |
41
|
1270 |
0 |
!GIT_ADD_SIZET_OVERFLOW(&reflen, reflen, 1) && |
53
|
0 |
507 |
GIT_ASSERT_ARG_WITH_RETVAL(name, NULL); |
54
|
0 |
507 |
GIT_ASSERT_ARG_WITH_RETVAL(target, NULL); |
57
|
0 |
507 |
if (!ref) |
62
|
0 |
507 |
if ((ref->target.symbolic = git__strdup(target)) == NULL) { |
77
|
0 |
763 |
GIT_ASSERT_ARG_WITH_RETVAL(name, NULL); |
78
|
0 |
763 |
GIT_ASSERT_ARG_WITH_RETVAL(oid, NULL); |
81
|
0 |
763 |
if (!ref) |
87
|
0 |
763 |
if (peel != NULL) |
99
|
0 |
1 |
GIT_ASSERT_ARG_WITH_RETVAL(ptr_to_ref, NULL); |
100
|
0 |
1 |
GIT_ASSERT_ARG_WITH_RETVAL(name, NULL); |
104
|
0 |
1 |
if (!GIT_ADD_SIZET_OVERFLOW(&reflen, sizeof(git_reference), namelen) && |
|
1 |
0 |
if (!GIT_ADD_SIZET_OVERFLOW(&reflen, sizeof(git_reference), namelen) && |
105
|
1 |
0 |
!GIT_ADD_SIZET_OVERFLOW(&reflen, reflen, 1) && |
116
|
0 |
0 |
if (source->type == GIT_REFERENCE_SYMBOLIC) |
121
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(*dest); |
131
|
1550 |
1264 |
if (reference == NULL) |
134
|
505 |
759 |
if (reference->type == GIT_REFERENCE_SYMBOLIC) |
137
|
1155 |
109 |
if (reference->db) |
138
|
1 |
1154 |
GIT_REFCOUNT_DEC(reference->db, git_refdb__free); |
|
1 |
0 |
GIT_REFCOUNT_DEC(reference->db, git_refdb__free); |
148
|
0 |
6 |
if (!strcmp(ref->name, "HEAD")) { |
153
|
4 |
2 |
if (ref->type == GIT_REFERENCE_DIRECT) |
166
|
0 |
0 |
if ((error = git_repository_refdb__weakptr(&db, repo)) < 0) |
184
|
30 |
143 |
if ((error = git_reference_lookup_resolved(&ref, repo, name, -1)) < 0) |
201
|
1114 |
0 |
if (!git_repository__configmap_lookup(&precompose, repo, GIT_CONFIGMAP_PRECOMPOSE) && |
|
0 |
1114 |
if (!git_repository__configmap_lookup(&precompose, repo, GIT_CONFIGMAP_PRECOMPOSE) && |
205
|
0 |
1114 |
if (!validate) |
221
|
0 |
991 |
GIT_ASSERT_ARG(ref_out); |
222
|
0 |
991 |
GIT_ASSERT_ARG(repo); |
223
|
0 |
991 |
GIT_ASSERT_ARG(name); |
225
|
981 |
10 |
if ((error = reference_normalize_for_repo(normalized, repo, name, true)) < 0 || |
|
981 |
0 |
if ((error = reference_normalize_for_repo(normalized, repo, name, true)) < 0 || |
226
|
125 |
856 |
(error = git_repository_refdb__weakptr(&refdb, repo)) < 0 || |
236
|
434 |
422 |
if (max_nesting && git_reference_type(*ref_out) == GIT_REFERENCE_SYMBOLIC) { |
|
3 |
431 |
if (max_nesting && git_reference_type(*ref_out) == GIT_REFERENCE_SYMBOLIC) { |
262
|
28 |
1 |
if (*refname) |
269
|
107 |
12 |
for (i = 0; formatters[i] && (fallbackmode || i == 0); i++) { |
|
106 |
1 |
for (i = 0; formatters[i] && (fallbackmode || i == 0); i++) { |
|
1 |
0 |
for (i = 0; formatters[i] && (fallbackmode || i == 0); i++) { |
273
|
107 |
0 |
if ((error = git_str_printf(&refnamebuf, formatters[i], git_str_cstr(&name))) < 0 || |
|
107 |
0 |
if ((error = git_str_printf(&refnamebuf, formatters[i], git_str_cstr(&name))) < 0 || |
277
|
16 |
91 |
if (!valid) { |
285
|
17 |
74 |
if (!error) { |
291
|
0 |
74 |
if (error != GIT_ENOTFOUND) |
296
|
12 |
17 |
if (error && !foundvalid) { |
|
0 |
12 |
if (error && !foundvalid) { |
302
|
12 |
17 |
if (error == GIT_ENOTFOUND) |
315
|
0 |
992 |
GIT_ASSERT_ARG(ref); |
321
|
0 |
207 |
GIT_ASSERT_ARG_WITH_RETVAL(ref, NULL); |
327
|
0 |
338 |
GIT_ASSERT_ARG_WITH_RETVAL(ref, NULL); |
333
|
0 |
381 |
GIT_ASSERT_ARG_WITH_RETVAL(ref, NULL); |
335
|
0 |
381 |
if (ref->type != GIT_REFERENCE_DIRECT) |
343
|
0 |
0 |
GIT_ASSERT_ARG_WITH_RETVAL(ref, NULL); |
345
|
0 |
0 |
if (ref->type != GIT_REFERENCE_DIRECT || git_oid_is_zero(&ref->peel)) |
|
0 |
0 |
if (ref->type != GIT_REFERENCE_DIRECT || git_oid_is_zero(&ref->peel)) |
353
|
0 |
424 |
GIT_ASSERT_ARG_WITH_RETVAL(ref, NULL); |
355
|
0 |
424 |
if (ref->type != GIT_REFERENCE_SYMBOLIC) |
378
|
0 |
99 |
GIT_ASSERT_ARG(repo); |
379
|
0 |
99 |
GIT_ASSERT_ARG(name); |
380
|
76 |
23 |
GIT_ASSERT_ARG(symbolic || signature); |
|
0 |
76 |
GIT_ASSERT_ARG(symbolic || signature); |
382
|
97 |
2 |
if (ref_out) |
386
|
0 |
99 |
if (error < 0) |
390
|
0 |
99 |
if (error < 0) |
393
|
76 |
23 |
if (oid != NULL) { |
394
|
0 |
76 |
GIT_ASSERT(symbolic == NULL); |
396
|
0 |
76 |
if (!git_object__is_valid(repo, oid, GIT_OBJECT_ANY)) { |
409
|
0 |
23 |
if (error < 0) |
415
|
0 |
99 |
GIT_ERROR_CHECK_ALLOC(ref); |
417
|
2 |
97 |
if ((error = git_refdb_write(refdb, ref, force, signature, log_message, old_id, old_target)) < 0) { |
422
|
2 |
95 |
if (ref_out == NULL) |
432
|
0 |
69 |
if (repo->ident_name && repo->ident_email) |
|
0 |
0 |
if (repo->ident_name && repo->ident_email) |
444
|
69 |
0 |
if(((error = refs_configured_ident(&who, repo)) < 0) && |
|
7 |
62 |
if(((error = refs_configured_ident(&who, repo)) < 0) && |
445
|
0 |
7 |
((error = git_signature_default(&who, repo)) < 0) && |
466
|
0 |
41 |
GIT_ASSERT_ARG(id); |
468
|
0 |
41 |
if ((error = git_reference__log_signature(&who, repo)) < 0) |
501
|
0 |
23 |
GIT_ASSERT_ARG(target); |
503
|
0 |
23 |
if ((error = git_reference__log_signature(&who, repo)) < 0) |
526
|
27 |
0 |
if (ref->type == GIT_REFERENCE_DIRECT) |
542
|
0 |
1 |
GIT_ASSERT_ARG(out); |
543
|
0 |
1 |
GIT_ASSERT_ARG(ref); |
544
|
0 |
1 |
GIT_ASSERT_ARG(id); |
548
|
0 |
1 |
if ((error = ensure_is_an_updatable_direct_reference(ref)) < 0) |
556
|
0 |
0 |
if (ref->type == GIT_REFERENCE_SYMBOLIC) |
571
|
0 |
0 |
GIT_ASSERT_ARG(out); |
572
|
0 |
0 |
GIT_ASSERT_ARG(ref); |
573
|
0 |
0 |
GIT_ASSERT_ARG(target); |
575
|
0 |
0 |
if ((error = ensure_is_an_updatable_symbolic_reference(ref)) < 0) |
593
|
0 |
1 |
if ((error = git_reference_lookup(&head, worktree, GIT_HEAD_FILE)) < 0) |
601
|
0 |
0 |
if ((error = git_reference_symbolic_set_target(&updated, head, payload->new_name, NULL)) < 0) { |
624
|
0 |
1 |
GIT_ASSERT_ARG(out); |
625
|
0 |
1 |
GIT_ASSERT_ARG(ref); |
629
|
1 |
0 |
if ((error = git_reference__log_signature(&signature, repo)) < 0 || |
|
1 |
0 |
if ((error = git_reference__log_signature(&signature, repo)) < 0 || |
630
|
1 |
0 |
(error = reference_normalize_for_repo(payload.new_name, repo, new_name, true)) < 0 || |
637
|
0 |
1 |
if ((error = git_repository_foreach_worktree(repo, refs_update_head, &payload)) < 0) |
669
|
0 |
0 |
if ((error = git_reference_iterator_new(&iter, repo)) < 0) |
672
|
0 |
0 |
while (!(error = git_reference_next(&ref, iter))) { |
673
|
0 |
0 |
if ((error = callback(ref, payload)) != 0) { |
679
|
0 |
0 |
if (error == GIT_ITEROVER) |
695
|
0 |
20 |
if ((error = git_reference_iterator_new(&iter, repo)) < 0) |
698
|
101 |
19 |
while (!(error = git_reference_next_name(&refname, iter))) { |
699
|
1 |
100 |
if ((error = callback(refname, payload)) != 0) { |
705
|
19 |
1 |
if (error == GIT_ITEROVER) |
722
|
0 |
0 |
if ((error = git_reference_iterator_glob_new(&iter, repo, glob)) < 0) |
725
|
0 |
0 |
while (!(error = git_reference_next_name(&refname, iter))) { |
726
|
0 |
0 |
if ((error = callback(refname, payload)) != 0) { |
732
|
0 |
0 |
if (error == GIT_ITEROVER) |
743
|
0 |
28 |
if (git_repository_refdb__weakptr(&refdb, repo) < 0) |
754
|
0 |
3 |
if (git_repository_refdb__weakptr(&refdb, repo) < 0) |
772
|
0 |
31 |
if (iter == NULL) |
781
|
0 |
2 |
GIT_ERROR_CHECK_ALLOC(name); |
791
|
0 |
4 |
GIT_ASSERT_ARG(array); |
792
|
0 |
4 |
GIT_ASSERT_ARG(repo); |
797
|
0 |
4 |
if (git_vector_init(&ref_list, 8, NULL) < 0) |
800
|
0 |
4 |
if (git_reference_foreach_name( |
813
|
0 |
16291 |
if ((unsigned) ch <= ' ') |
816
|
0 |
16291 |
switch (ch) { |
836
|
0 |
2983 |
if (*current == '.') |
840
|
17962 |
1312 |
if (*current == '\0' || *current == '/') |
|
16291 |
1671 |
if (*current == '\0' || *current == '/') |
843
|
0 |
16291 |
if (!is_valid_ref_char(*current)) |
846
|
36 |
16255 |
if (prev == '.' && *current == '.') |
|
0 |
36 |
if (prev == '.' && *current == '.') |
849
|
0 |
16291 |
if (prev == '@' && *current == '{') |
|
0 |
0 |
if (prev == '@' && *current == '{') |
852
|
26 |
16265 |
if (*current == '*') { |
853
|
0 |
26 |
if (!may_contain_glob) |
864
|
1096 |
1887 |
if (segment_len >= lock_len && |
|
0 |
1096 |
if (segment_len >= lock_len && |
876
|
0 |
1312 |
GIT_ASSERT_ARG(name); |
877
|
0 |
1312 |
GIT_ASSERT_ARG(len > 0); |
879
|
2707 |
465 |
for (i = 0; i < len; i++) |
882
|
2706 |
1 |
if ((c < 'A' || c > 'Z') && c != '_') |
|
846 |
1860 |
if ((c < 'A' || c > 'Z') && c != '_') |
|
847 |
0 |
if ((c < 'A' || c > 'Z') && c != '_') |
886
|
465 |
0 |
if (*name == '_' || name[len - 1] == '_') |
|
0 |
465 |
if (*name == '_' || name[len - 1] == '_') |
908
|
0 |
1312 |
GIT_ASSERT_ARG(name); |
913
|
1312 |
0 |
if (validate && *current == '/') |
|
0 |
1312 |
if (validate && *current == '/') |
916
|
1115 |
197 |
if (normalize) |
929
|
0 |
1312 |
if (!validate) { |
932
|
0 |
0 |
error = git_str_oom(buf) ? -1 : 0; |
940
|
0 |
2983 |
if (segment_len < 0) |
943
|
2983 |
0 |
if (segment_len > 0) { |
948
|
26 |
2957 |
if (memchr(current, '*', segment_len)) |
951
|
2389 |
594 |
if (normalize) { |
955
|
1274 |
1115 |
git_str_truncate(buf, |
958
|
0 |
2389 |
if (git_str_oom(buf)) { |
968
|
0 |
2983 |
if (segment_len == 0 && !normalize) |
|
0 |
0 |
if (segment_len == 0 && !normalize) |
971
|
1312 |
1671 |
if (current[segment_len] == '\0') |
978
|
0 |
1312 |
if (segment_len == 0 && segments_count == 0) |
|
0 |
0 |
if (segment_len == 0 && segments_count == 0) |
982
|
0 |
1312 |
if (current[segment_len - 1] == '.') |
986
|
0 |
1312 |
if (current[segment_len - 1] == '/') |
989
|
491 |
821 |
if ((segments_count == 1 ) && !(flags & GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL)) |
|
0 |
491 |
if ((segments_count == 1 ) && !(flags & GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL)) |
992
|
491 |
821 |
if ((segments_count == 1 ) && |
|
491 |
0 |
if ((segments_count == 1 ) && |
993
|
26 |
465 |
!(flags & GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND) && |
994
|
0 |
26 |
!(is_all_caps_and_underscore(name, (size_t)segment_len) || |
995
|
0 |
0 |
((flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name)))) |
998
|
821 |
465 |
if ((segments_count > 1) |
999
|
0 |
821 |
&& (is_all_caps_and_underscore(name, strchr(name, '/') - name))) |
1005
|
26 |
1286 |
if (error == GIT_EINVALIDSPEC) |
1010
|
26 |
1286 |
if (error && normalize) |
|
10 |
16 |
if (error && normalize) |
1029
|
10 |
1104 |
if ((error = git_reference__normalize_name(&buf, name, flags)) < 0) |
1032
|
0 |
1104 |
if (git_str_len(&buf) > buffer_size - 1) { |
1040
|
0 |
1104 |
if ((error = git_str_copy_cstr(buffer_out, buffer_size, &buf)) < 0) |
1058
|
0 |
0 |
GIT_ASSERT_ARG(ref1); |
1059
|
0 |
0 |
GIT_ASSERT_ARG(ref2); |
1065
|
0 |
0 |
if (type1 != type2) |
1066
|
0 |
0 |
return (type1 == GIT_REFERENCE_SYMBOLIC) ? -1 : 1; |
1068
|
0 |
0 |
if (type1 == GIT_REFERENCE_SYMBOLIC) |
1092
|
2 |
7 |
if (!sig && (error = git_reference__log_signature(&who, repo)) < 0) |
|
0 |
2 |
if (!sig && (error = git_reference__log_signature(&who, repo)) < 0) |
1095
|
7 |
2 |
to_use = sig ? sig : who; |
1097
|
0 |
9 |
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0) |
1100
|
1 |
8 |
if ((error = git_refdb_resolve(&ref, refdb, ref_name, -1)) < 0) { |
1101
|
1 |
0 |
if (error == GIT_ENOTFOUND) { |
1110
|
3 |
5 |
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) { |
1129
|
1 |
32 |
if (count >= 2) |
1131
|
4 |
28 |
else if (count == 0) |
1150
|
33 |
0 |
if ((error = git_commit_lookup(&commit, repo, id)) < 0 || |
|
33 |
0 |
if ((error = git_commit_lookup(&commit, repo, id)) < 0 || |
1151
|
33 |
0 |
(error = git_str_printf(&reflog_msg, "%s%s: %s", |
1159
|
26 |
7 |
if (ref) { |
1160
|
0 |
26 |
if ((error = ensure_is_an_updatable_direct_reference(ref)) < 0) |
1182
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
1183
|
0 |
0 |
GIT_ASSERT_ARG(refname); |
1185
|
0 |
0 |
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0) |
1196
|
0 |
6 |
GIT_ASSERT_ARG(repo); |
1197
|
0 |
6 |
GIT_ASSERT_ARG(refname); |
1199
|
0 |
6 |
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0) |
1212
|
0 |
64 |
GIT_ASSERT_ARG(ref); |
1223
|
0 |
7 |
GIT_ASSERT_ARG(ref); |
1234
|
0 |
7 |
GIT_ASSERT_ARG(ref); |
1245
|
0 |
7 |
GIT_ASSERT_ARG(ref); |
1267
|
0 |
210 |
GIT_ASSERT_ARG(ref); |
1269
|
200 |
10 |
if (ref->type == GIT_REFERENCE_DIRECT) { |
1272
|
0 |
10 |
if ((error = git_reference_resolve(&allocated, ref)) < 0) |
1284
|
210 |
0 |
if (target_type != GIT_OBJECT_TAG && !git_oid_is_zero(&resolved->peel)) { |
|
0 |
210 |
if (target_type != GIT_OBJECT_TAG && !git_oid_is_zero(&resolved->peel)) { |
1292
|
0 |
210 |
if (error < 0) { |
1297
|
0 |
210 |
if (target_type == GIT_OBJECT_ANY && git_object_type(target) != GIT_OBJECT_TAG) |
|
0 |
0 |
if (target_type == GIT_OBJECT_ANY && git_object_type(target) != GIT_OBJECT_TAG) |
1316
|
197 |
0 |
GIT_ASSERT(valid && refname); |
|
0 |
197 |
GIT_ASSERT(valid && refname); |
1322
|
181 |
16 |
if (!error) |
1324
|
16 |
0 |
else if (error == GIT_EINVALIDSPEC) |
1337
|
41 |
1 |
if (!git__prefixcmp(name, GIT_REFS_HEADS_DIR)) |
1339
|
0 |
1 |
else if (!git__prefixcmp(name, GIT_REFS_TAGS_DIR)) |
1341
|
0 |
1 |
else if (!git__prefixcmp(name, GIT_REFS_REMOTES_DIR)) |
1343
|
1 |
0 |
else if (!git__prefixcmp(name, GIT_REFS_DIR)) |
1360
|
0 |
5 |
GIT_ASSERT_ARG(unborn); |
1361
|
0 |
5 |
GIT_ASSERT_ARG(ref); |
1362
|
0 |
5 |
GIT_ASSERT_ARG(repo); |
1364
|
0 |
5 |
if (ref->type == GIT_REFERENCE_DIRECT) { |
1372
|
0 |
5 |
if (error != 0 && error != GIT_ENOTFOUND) |
|
0 |
0 |
if (error != 0 && error != GIT_ENOTFOUND) |
1374
|
0 |
5 |
else if (error == GIT_ENOTFOUND && git__strcmp(ref->name, GIT_HEAD_FILE) == 0) |
|
0 |
0 |
else if (error == GIT_ENOTFOUND && git__strcmp(ref->name, GIT_HEAD_FILE) == 0) |