| line |
true |
false |
branch |
|
94
|
2 |
63 |
if (odb) { |
|
99
|
35 |
30 |
if ((odb = git_atomic_swap(repo->_odb, odb)) != NULL) { |
|
107
|
0 |
63 |
if (refdb) { |
|
112
|
54 |
9 |
if ((refdb = git_atomic_swap(repo->_refdb, refdb)) != NULL) { |
|
120
|
0 |
63 |
if (config) { |
|
125
|
63 |
0 |
if ((config = git_atomic_swap(repo->_config, config)) != NULL) { |
|
135
|
1 |
64 |
if (index) { |
|
140
|
17 |
48 |
if ((index = git_atomic_swap(repo->_index, index)) != NULL) { |
|
148
|
0 |
63 |
GIT_ASSERT_ARG(repo); |
|
166
|
18 |
63 |
if (repo == NULL) |
|
176
|
0 |
63 |
for (i = 0; i < repo->reserved_names.size; i++) |
|
177
|
0 |
0 |
git_str_dispose(git_array_get(repo->reserved_names, i)); |
|
202
|
65 |
5 |
if (!git_fs_path_contains_file(repository_path, GIT_COMMONDIR_FILE)) { |
|
203
|
65 |
0 |
if ((error = git_str_set(commondir, repository_path->ptr, repository_path->size)) == 0) |
|
212
|
5 |
0 |
if ((error = git_str_joinpath(&common_link, repository_path->ptr, GIT_COMMONDIR_FILE)) < 0 || |
|
|
5 |
0 |
if ((error = git_str_joinpath(&common_link, repository_path->ptr, GIT_COMMONDIR_FILE)) < 0 || |
|
217
|
0 |
5 |
if (git_fs_path_is_relative(common_link.ptr)) { |
|
218
|
0 |
0 |
if ((error = git_str_joinpath(commondir, repository_path->ptr, common_link.ptr)) < 0) |
|
261
|
0 |
70 |
if ((error = lookup_commondir(&separate_commondir, common_path, repository_path)) < 0) |
|
265
|
6 |
64 |
if (git_fs_path_contains_file(repository_path, GIT_HEAD_FILE) == false) |
|
269
|
0 |
64 |
if (git_fs_path_contains_dir(common_path, GIT_OBJECTS_DIR) == false) |
|
271
|
0 |
64 |
if (git_fs_path_contains_dir(common_path, GIT_REFS_DIR) == false) |
|
275
|
64 |
0 |
if ((error = validate_repo_path(common_path)) < 0 || |
|
|
5 |
59 |
if ((error = validate_repo_path(common_path)) < 0 || |
|
276
|
0 |
5 |
(separate_commondir && |
|
293
|
0 |
63 |
if (!repo->reserved_names.ptr) |
|
302
|
0 |
0 |
if (repo) |
|
314
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(repo); |
|
327
|
0 |
63 |
if (err < 0 && err != GIT_ENOTFOUND) |
|
|
0 |
0 |
if (err < 0 && err != GIT_ENOTFOUND) |
|
331
|
63 |
0 |
if (err != GIT_ENOTFOUND) |
|
332
|
8 |
55 |
repo->is_bare = is_bare && !repo->is_worktree; |
|
|
8 |
0 |
repo->is_bare = is_bare && !repo->is_worktree; |
|
346
|
8 |
55 |
if (repo->is_bare) |
|
349
|
0 |
55 |
if ((error = git_config__lookup_entry( |
|
353
|
5 |
50 |
if (repo->is_worktree) { |
|
355
|
0 |
5 |
if (!gitlink) { |
|
370
|
0 |
50 |
else if (ce && ce->value) { |
|
|
0 |
0 |
else if (ce && ce->value) { |
|
371
|
0 |
0 |
if ((error = git_fs_path_prettify_dir( |
|
377
|
50 |
0 |
else if (parent_path && git_fs_path_isdir(parent_path->ptr)) |
|
|
50 |
0 |
else if (parent_path && git_fs_path_isdir(parent_path->ptr)) |
|
389
|
0 |
55 |
GIT_ERROR_CHECK_ALLOC(repo->workdir); |
|
413
|
0 |
1 |
GIT_ASSERT_ARG(path); |
|
417
|
0 |
1 |
if (ceiling_directories == NULL || min_len == 0) |
|
|
0 |
0 |
if (ceiling_directories == NULL || min_len == 0) |
|
420
|
0 |
0 |
for (sep = ceil = ceiling_directories; *sep; ceil = sep + 1) { |
|
421
|
0 |
0 |
for (sep = ceil; *sep && *sep != GIT_PATH_LIST_SEPARATOR; sep++); |
|
|
0 |
0 |
for (sep = ceil; *sep && *sep != GIT_PATH_LIST_SEPARATOR; sep++); |
|
424
|
0 |
0 |
if (len == 0 || len >= sizeof(buf) || git_fs_path_root(ceil) == -1) |
|
|
0 |
0 |
if (len == 0 || len >= sizeof(buf) || git_fs_path_root(ceil) == -1) |
|
|
0 |
0 |
if (len == 0 || len >= sizeof(buf) || git_fs_path_root(ceil) == -1) |
|
430
|
0 |
0 |
if (p_realpath(buf, buf2) == NULL) |
|
434
|
0 |
0 |
if (len > 0 && buf2[len-1] == '/') |
|
|
0 |
0 |
if (len > 0 && buf2[len-1] == '/') |
|
437
|
0 |
0 |
if (!strncmp(path, buf2, len) && |
|
|
0 |
0 |
if (!strncmp(path, buf2, len) && |
|
438
|
0 |
0 |
(path[len] == '/' || !path[len]) && |
|
|
0 |
0 |
(path[len] == '/' || !path[len]) && |
|
459
|
0 |
5 |
GIT_ASSERT_ARG(path_out); |
|
460
|
0 |
5 |
GIT_ASSERT_ARG(file_path); |
|
462
|
0 |
5 |
if (git_futils_readbuffer(&file, file_path) < 0) |
|
476
|
5 |
0 |
else if ((error = git_fs_path_dirname_r(path_out, file_path)) >= 0) { |
|
478
|
10 |
0 |
while (*gitlink && git__isspace(*gitlink)) gitlink++; |
|
|
5 |
5 |
while (*gitlink && git__isspace(*gitlink)) gitlink++; |
|
498
|
0 |
0 |
if (strcmp(entry->value, "") == 0) |
|
501
|
0 |
0 |
if (git_fs_path_prettify_dir(&data->tmp, entry->value, NULL) == 0 && |
|
|
0 |
0 |
if (git_fs_path_prettify_dir(&data->tmp, entry->value, NULL) == 0 && |
|
516
|
0 |
0 |
if (load_global_config(&config) != 0) |
|
538
|
123 |
0 |
if (path) |
|
541
|
0 |
123 |
if (error == GIT_ENOTFOUND) { |
|
565
|
55 |
8 |
if (repo->workdir) |
|
568
|
5 |
58 |
if (repo->gitlink) |
|
573
|
123 |
63 |
for (i = 0; i < validation_len; i++) { |
|
576
|
0 |
123 |
if ((error = validate_ownership_path(&is_safe, path)) < 0) |
|
579
|
0 |
123 |
if (!is_safe) |
|
583
|
0 |
63 |
if (is_safe || |
|
|
0 |
0 |
if (is_safe || |
|
587
|
0 |
0 |
if (!is_safe) { |
|
620
|
0 |
64 |
if (error < 0) |
|
630
|
0 |
64 |
if (flags & (GIT_REPOSITORY_OPEN_BARE | GIT_REPOSITORY_OPEN_NO_DOTGIT)) { |
|
639
|
96 |
0 |
if (!(flags & GIT_REPOSITORY_OPEN_NO_DOTGIT)) { |
|
640
|
65 |
31 |
if (!in_dot_git) { |
|
641
|
0 |
65 |
if ((error = git_str_joinpath(&path, path.ptr, DOT_GIT)) < 0) |
|
647
|
65 |
31 |
if (p_stat(path.ptr, &st) == 0) { |
|
649
|
64 |
1 |
if (initial_device == 0) |
|
651
|
0 |
1 |
else if (st.st_dev != initial_device && |
|
|
0 |
0 |
else if (st.st_dev != initial_device && |
|
655
|
60 |
5 |
if (S_ISDIR(st.st_mode)) { |
|
656
|
0 |
60 |
if ((error = is_valid_repository_path(&is_valid, &path, &common_link)) < 0) |
|
659
|
59 |
1 |
if (is_valid) { |
|
660
|
59 |
0 |
if ((error = git_fs_path_to_dir(&path)) < 0 || |
|
|
59 |
0 |
if ((error = git_fs_path_to_dir(&path)) < 0 || |
|
664
|
58 |
1 |
if (gitlink_path) |
|
665
|
0 |
58 |
if ((error = git_str_attach(gitlink_path, git_worktree__read_link(path.ptr, GIT_GITDIR_FILE), 0)) < 0) |
|
667
|
58 |
1 |
if (commondir_path) |
|
672
|
5 |
0 |
} else if (S_ISREG(st.st_mode) && git__suffixcmp(path.ptr, "/" DOT_GIT) == 0) { |
|
|
5 |
0 |
} else if (S_ISREG(st.st_mode) && git__suffixcmp(path.ptr, "/" DOT_GIT) == 0) { |
|
673
|
5 |
0 |
if ((error = read_gitfile(&repo_link, path.ptr)) < 0 || |
|
|
5 |
0 |
if ((error = read_gitfile(&repo_link, path.ptr)) < 0 || |
|
677
|
5 |
0 |
if (is_valid) { |
|
680
|
5 |
0 |
if (gitlink_path) |
|
681
|
0 |
5 |
if ((error = git_str_put(gitlink_path, path.ptr, path.size)) < 0) |
|
683
|
5 |
0 |
if (commondir_path) |
|
693
|
0 |
32 |
if ((error = git_fs_path_dirname_r(&path, path.ptr)) < 0) |
|
698
|
32 |
0 |
if (min_iterations && (--min_iterations == 0)) |
|
|
1 |
31 |
if (min_iterations && (--min_iterations == 0)) |
|
702
|
1 |
31 |
if (min_iterations == 0 && |
|
|
1 |
0 |
if (min_iterations == 0 && |
|
703
|
1 |
0 |
(path.ptr[ceiling_offset] == 0 || (flags & GIT_REPOSITORY_OPEN_NO_SEARCH))) |
|
707
|
63 |
1 |
if (workdir_path && !(flags & GIT_REPOSITORY_OPEN_BARE)) { |
|
|
63 |
0 |
if (workdir_path && !(flags & GIT_REPOSITORY_OPEN_BARE)) { |
|
708
|
0 |
63 |
if (!git_str_len(gitdir_path)) |
|
710
|
63 |
0 |
else if ((error = git_fs_path_dirname_r(workdir_path, path.ptr)) < 0 || |
|
|
63 |
0 |
else if ((error = git_fs_path_dirname_r(workdir_path, path.ptr)) < 0 || |
|
717
|
0 |
64 |
if (!git_str_len(gitdir_path)) { |
|
739
|
0 |
0 |
if ((error = git_fs_path_prettify_dir(&path, bare_path, NULL)) < 0 || |
|
|
0 |
0 |
if ((error = git_fs_path_prettify_dir(&path, bare_path, NULL)) < 0 || |
|
743
|
0 |
0 |
if (!is_valid) { |
|
751
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(repo); |
|
754
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(repo->gitdir); |
|
756
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(repo->commondir); |
|
787
|
0 |
0 |
if (!start_path) { |
|
789
|
0 |
0 |
if (error == GIT_ENOTFOUND) { |
|
792
|
0 |
0 |
} else if (error < 0) |
|
802
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
804
|
0 |
0 |
else if (error < 0) |
|
810
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
812
|
0 |
0 |
else if (error < 0) |
|
817
|
0 |
0 |
if (error < 0) |
|
819
|
0 |
0 |
if (across_fs) |
|
824
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
826
|
0 |
0 |
else if (error < 0) |
|
830
|
0 |
0 |
if (error < 0) |
|
835
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
837
|
0 |
0 |
else if (error < 0) |
|
841
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
843
|
0 |
0 |
else if (error < 0) |
|
847
|
0 |
0 |
if (error < 0) |
|
852
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
854
|
0 |
0 |
else if (error < 0) |
|
863
|
0 |
0 |
if (error == GIT_ENOTFOUND) |
|
865
|
0 |
0 |
else if (error < 0) |
|
874
|
0 |
0 |
if (error < 0) |
|
877
|
0 |
0 |
if (odb) |
|
881
|
0 |
0 |
if (error == GIT_ENOTFOUND) { |
|
884
|
0 |
0 |
} else if (error < 0) |
|
889
|
0 |
0 |
if (!odb) { |
|
891
|
0 |
0 |
if (error < 0) |
|
896
|
0 |
0 |
for (sep = alt = alts_buf.ptr; sep != end; alt = sep+1) { |
|
897
|
0 |
0 |
for (sep = alt; *sep && *sep != GIT_PATH_LIST_SEPARATOR; sep++) |
|
|
0 |
0 |
for (sep = alt; *sep && *sep != GIT_PATH_LIST_SEPARATOR; sep++) |
|
899
|
0 |
0 |
if (*sep) |
|
902
|
0 |
0 |
if (error < 0) |
|
907
|
0 |
0 |
if (git_str_len(&namespace_buf)) { |
|
909
|
0 |
0 |
if (error < 0) |
|
915
|
0 |
0 |
if (out) { |
|
942
|
63 |
0 |
if (repo->commondir && repo->gitdir |
|
|
63 |
0 |
if (repo->commondir && repo->gitdir |
|
943
|
58 |
5 |
&& !strcmp(repo->commondir, repo->gitdir)) { |
|
948
|
0 |
5 |
if ((error = git_str_joinpath(&gitdir_link, repo->gitdir, "gitdir")) < 0) |
|
973
|
0 |
63 |
if (flags & GIT_REPOSITORY_OPEN_FROM_ENV) |
|
976
|
63 |
0 |
if (repo_ptr) |
|
982
|
63 |
0 |
if (error < 0 || !repo_ptr) |
|
|
63 |
0 |
if (error < 0 || !repo_ptr) |
|
986
|
0 |
63 |
GIT_ERROR_CHECK_ALLOC(repo); |
|
989
|
0 |
63 |
GIT_ERROR_CHECK_ALLOC(repo->gitdir); |
|
991
|
5 |
58 |
if (gitlink.size) { |
|
993
|
0 |
5 |
GIT_ERROR_CHECK_ALLOC(repo->gitlink); |
|
995
|
63 |
0 |
if (commondir.size) { |
|
997
|
0 |
63 |
GIT_ERROR_CHECK_ALLOC(repo->commondir); |
|
1000
|
0 |
63 |
if ((error = repo_is_worktree(&is_worktree, repo)) < 0) |
|
1010
|
0 |
63 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
1013
|
63 |
0 |
if (config && (error = check_repositoryformatversion(&version, config)) < 0) |
|
|
0 |
63 |
if (config && (error = check_repositoryformatversion(&version, config)) < 0) |
|
1016
|
0 |
63 |
if ((error = check_extensions(config, version)) < 0) |
|
1019
|
0 |
63 |
if ((flags & GIT_REPOSITORY_OPEN_BARE) != 0) { |
|
1022
|
63 |
0 |
if (config && |
|
|
63 |
0 |
if (config && |
|
1023
|
63 |
0 |
((error = load_config_data(repo, config)) < 0 || |
|
1032
|
63 |
0 |
if (git_repository__validate_ownership && |
|
|
0 |
63 |
if (git_repository__validate_ownership && |
|
1043
|
0 |
63 |
if (error < 0) |
|
1045
|
63 |
0 |
else if (repo_ptr) |
|
1064
|
0 |
2 |
GIT_ASSERT_ARG(repo_out); |
|
1065
|
0 |
2 |
GIT_ASSERT_ARG(wt); |
|
1070
|
2 |
0 |
if (len <= 4 || strcasecmp(wt->gitlink_path + len - 4, ".git")) { |
|
|
0 |
2 |
if (len <= 4 || strcasecmp(wt->gitlink_path + len - 4, ".git")) { |
|
1075
|
0 |
2 |
if ((err = git_str_set(&path, wt->gitlink_path, len - 4)) < 0) |
|
1078
|
0 |
2 |
if ((err = git_repository_open(&repo, path.ptr)) < 0) |
|
1094
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(repo); |
|
1108
|
1 |
0 |
uint32_t flags = across_fs ? GIT_REPOSITORY_OPEN_CROSS_FS : 0; |
|
1110
|
0 |
1 |
GIT_ASSERT_ARG(start_path); |
|
1112
|
1 |
0 |
GIT_BUF_WRAP_PRIVATE(out, find_repo, NULL, NULL, NULL, start_path, flags, ceiling_dirs); |
|
|
1 |
0 |
GIT_BUF_WRAP_PRIVATE(out, find_repo, NULL, NULL, NULL, start_path, flags, ceiling_dirs); |
|
1127
|
0 |
63 |
GIT_ASSERT_ARG(out); |
|
1129
|
0 |
63 |
if ((error = git_config_new(&cfg)) < 0) |
|
1132
|
63 |
0 |
if (repo) { |
|
1133
|
63 |
0 |
if ((error = git_repository__item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG)) == 0) |
|
1136
|
0 |
63 |
if (error && error != GIT_ENOTFOUND) |
|
|
0 |
0 |
if (error && error != GIT_ENOTFOUND) |
|
1142
|
63 |
0 |
if (global_config_path != NULL && |
|
|
0 |
63 |
if (global_config_path != NULL && |
|
1144
|
0 |
0 |
cfg, global_config_path, GIT_CONFIG_LEVEL_GLOBAL, repo, 0)) < 0 && |
|
1148
|
0 |
63 |
if (xdg_config_path != NULL && |
|
|
0 |
0 |
if (xdg_config_path != NULL && |
|
1150
|
0 |
0 |
cfg, xdg_config_path, GIT_CONFIG_LEVEL_XDG, repo, 0)) < 0 && |
|
1154
|
0 |
63 |
if (system_config_path != NULL && |
|
|
0 |
0 |
if (system_config_path != NULL && |
|
1156
|
0 |
0 |
cfg, system_config_path, GIT_CONFIG_LEVEL_SYSTEM, repo, 0)) < 0 && |
|
1160
|
0 |
63 |
if (programdata_path != NULL && |
|
|
0 |
0 |
if (programdata_path != NULL && |
|
1162
|
0 |
0 |
cfg, programdata_path, GIT_CONFIG_LEVEL_PROGRAMDATA, repo, 0)) < 0 && |
|
1180
|
63 |
189 |
return git_str_len(buf) > 0 ? git_str_cstr(buf) : NULL; |
|
1187
|
63 |
931 |
if (repo->_config == NULL) { |
|
1200
|
0 |
63 |
if (git_str_len(&global_buf) == 0) |
|
1209
|
63 |
0 |
if (!error) { |
|
1212
|
0 |
63 |
if (git_atomic_compare_and_swap(&repo->_config, NULL, config) != NULL) { |
|
1230
|
0 |
15 |
if (git_repository_config__weakptr(out, repo) < 0) |
|
1242
|
0 |
502 |
if ((error = git_repository_config__weakptr(&weak, repo)) < 0) |
|
1250
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
1251
|
0 |
0 |
GIT_ASSERT_ARG(config); |
|
1261
|
0 |
2346 |
GIT_ASSERT_ARG(repo); |
|
1262
|
0 |
2346 |
GIT_ASSERT_ARG(out); |
|
1265
|
33 |
2313 |
if (*out == NULL) { |
|
1269
|
33 |
0 |
if ((error = git_repository__item_path(&odb_path, repo, |
|
1270
|
0 |
33 |
GIT_REPOSITORY_ITEM_OBJECTS)) < 0 || |
|
1276
|
33 |
0 |
if ((error = git_odb__set_caps(odb, GIT_ODB_CAP_FROM_OWNER)) < 0 || |
|
|
0 |
33 |
if ((error = git_odb__set_caps(odb, GIT_ODB_CAP_FROM_OWNER)) < 0 || |
|
1282
|
0 |
33 |
if (git_atomic_compare_and_swap(&repo->_odb, NULL, odb) != NULL) { |
|
1296
|
0 |
164 |
if (git_repository_odb__weakptr(out, repo) < 0) |
|
1305
|
0 |
2 |
GIT_ASSERT_ARG(repo); |
|
1306
|
0 |
2 |
GIT_ASSERT_ARG(odb); |
|
1316
|
0 |
1320 |
GIT_ASSERT_ARG(out); |
|
1317
|
0 |
1320 |
GIT_ASSERT_ARG(repo); |
|
1319
|
54 |
1266 |
if (repo->_refdb == NULL) { |
|
1323
|
54 |
0 |
if (!error) { |
|
1326
|
0 |
54 |
if (git_atomic_compare_and_swap(&repo->_refdb, NULL, refdb) != NULL) { |
|
1339
|
0 |
83 |
if (git_repository_refdb__weakptr(out, repo) < 0) |
|
1348
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
1349
|
0 |
0 |
GIT_ASSERT_ARG(refdb); |
|
1359
|
0 |
3036 |
GIT_ASSERT_ARG(out); |
|
1360
|
0 |
3036 |
GIT_ASSERT_ARG(repo); |
|
1362
|
16 |
3020 |
if (repo->_index == NULL) { |
|
1366
|
0 |
16 |
if ((error = git_str_joinpath(&index_path, repo->gitdir, GIT_INDEX_FILE)) < 0) |
|
1370
|
16 |
0 |
if (!error) { |
|
1373
|
0 |
16 |
if (git_atomic_compare_and_swap(&repo->_index, NULL, index) != NULL) { |
|
1391
|
0 |
219 |
if (git_repository_index__weakptr(out, repo) < 0) |
|
1400
|
0 |
2 |
GIT_ASSERT_ARG(repo); |
|
1409
|
0 |
0 |
if (namespace == NULL) { |
|
1414
|
0 |
0 |
return (repo->namespace = git__strdup(namespace)) ? 0 : -1; |
|
1512
|
370 |
0 |
if (include_ntfs) { |
|
1530
|
0 |
63 |
if (error == GIT_ENOTFOUND) |
|
1533
|
0 |
63 |
if (error < 0) |
|
1536
|
0 |
63 |
if (GIT_REPO_MAX_VERSION < *version) { |
|
1562
|
0 |
0 |
git_vector_foreach (&user_extensions, i, extension) { |
|
1569
|
0 |
0 |
if ((reject = (extension[0] == '!')) == true) |
|
1572
|
0 |
0 |
if ((error = git_str_printf(&cfg, "extensions.%s", extension)) < 0) |
|
1575
|
0 |
0 |
if (strcmp(entry->name, cfg.ptr) == 0) { |
|
1576
|
0 |
0 |
if (reject) |
|
1583
|
0 |
0 |
for (i = 0; i < ARRAY_SIZE(builtin_extensions); i++) { |
|
1587
|
0 |
0 |
if ((error = git_str_printf(&cfg, "extensions.%s", extension)) < 0) |
|
1590
|
0 |
0 |
if (strcmp(entry->name, cfg.ptr) == 0) |
|
1605
|
68 |
0 |
if (version < 1) |
|
1618
|
0 |
0 |
if (git_vector_init(&extensions, 8, NULL) < 0) |
|
1621
|
0 |
0 |
for (i = 0; i < ARRAY_SIZE(builtin_extensions); i++) { |
|
1626
|
0 |
0 |
git_vector_foreach (&user_extensions, j, user) { |
|
1627
|
0 |
0 |
if (user[0] == '!' && strcmp(builtin, &user[1]) == 0) { |
|
|
0 |
0 |
if (user[0] == '!' && strcmp(builtin, &user[1]) == 0) { |
|
1633
|
0 |
0 |
if (match) |
|
1641
|
0 |
0 |
git_vector_foreach (&user_extensions, i, user) { |
|
1642
|
0 |
0 |
if (user[0] == '!') |
|
1661
|
0 |
0 |
for (i = 0; i < len; i++) { |
|
1682
|
7 |
0 |
if ((error = git_str_joinpath(&ref_path, git_dir, GIT_HEAD_FILE)) < 0 || |
|
|
7 |
0 |
if ((error = git_str_joinpath(&ref_path, git_dir, GIT_HEAD_FILE)) < 0 || |
|
1686
|
2 |
5 |
if (git__prefixcmp(ref_name, GIT_REFS_DIR) == 0) |
|
1691
|
7 |
0 |
if ((error = git_filebuf_printf(&ref, fmt, ref_name)) < 0 || |
|
1705
|
0 |
5 |
if (p_stat(file_path, &st1) < 0) |
|
1708
|
0 |
5 |
if (p_chmod(file_path, st1.st_mode ^ S_IXUSR) < 0) |
|
1711
|
0 |
5 |
if (p_stat(file_path, &st2) < 0) |
|
1722
|
5 |
0 |
if (!git_str_joinpath(&path, gitdir_path, "CoNfIg")) |
|
1779
|
0 |
5 |
if (!(symlinks = git_fs_path_supports_symlinks(wd_path))) |
|
1791
|
0 |
5 |
if ((fd = p_creat(path, mode)) < 0) { |
|
1796
|
0 |
5 |
if (p_close(fd) < 0) { |
|
1814
|
0 |
5 |
if (git_str_joinpath(config_dir, repo_dir, GIT_CONFIG_FILENAME_INREPO) < 0) |
|
1819
|
5 |
0 |
if (!git_fs_path_isfile(cfg_path) && |
|
|
0 |
5 |
if (!git_fs_path_isfile(cfg_path) && |
|
1824
|
5 |
0 |
if (!repo) |
|
1828
|
0 |
0 |
if ((error = git_repository_config__weakptr(&parent, repo)) < 0) |
|
1831
|
0 |
0 |
if (git_config_open_level(out, parent, GIT_CONFIG_LEVEL_LOCAL) < 0) { |
|
1834
|
0 |
0 |
if (!(error = git_config_add_file_ondisk( |
|
1853
|
2 |
3 |
if (!work_dir) |
|
1856
|
0 |
5 |
if ((error = git_config_set_bool( |
|
1860
|
0 |
5 |
if (!are_symlinks_supported(work_dir)) { |
|
1861
|
0 |
0 |
if ((error = git_config_set_bool(cfg, "core.symlinks", false)) < 0) |
|
1863
|
5 |
0 |
} else if (git_config_delete_entry(cfg, "core.symlinks") < 0) |
|
1866
|
5 |
0 |
if (update_ignorecase) { |
|
1867
|
0 |
5 |
if (is_filesystem_case_insensitive(repo_dir)) { |
|
1868
|
0 |
0 |
if ((error = git_config_set_bool(cfg, "core.ignorecase", true)) < 0) |
|
1870
|
5 |
0 |
} else if (git_config_delete_entry(cfg, "core.ignorecase") < 0) |
|
1898
|
0 |
5 |
if ((error = repo_local_config(&config, &cfg_path, NULL, repo_dir)) < 0) |
|
1901
|
0 |
5 |
if (is_reinit && (error = check_repositoryformatversion(&version, config)) < 0) |
|
|
0 |
0 |
if (is_reinit && (error = check_repositoryformatversion(&version, config)) < 0) |
|
1904
|
0 |
5 |
if ((error = check_extensions(config, version)) < 0) |
|
1911
|
0 |
5 |
SET_REPO_CONFIG(bool, "core.bare", is_bare); |
|
1912
|
0 |
5 |
SET_REPO_CONFIG(int32, "core.repositoryformatversion", GIT_REPO_VERSION); |
|
1914
|
0 |
5 |
if ((error = repo_init_fs_configs( |
|
1918
|
3 |
2 |
if (!is_bare) { |
|
1919
|
0 |
3 |
SET_REPO_CONFIG(bool, "core.logallrefupdates", true); |
|
1921
|
0 |
3 |
if (!(flags & GIT_REPOSITORY_INIT__NATURAL_WD)) { |
|
1922
|
0 |
0 |
if ((error = git_str_sets(&worktree_path, work_dir)) < 0) |
|
1925
|
0 |
0 |
if ((flags & GIT_REPOSITORY_INIT_RELATIVE_GITLINK)) |
|
1926
|
0 |
0 |
if ((error = git_fs_path_make_relative(&worktree_path, repo_dir)) < 0) |
|
1929
|
0 |
0 |
SET_REPO_CONFIG(string, "core.worktree", worktree_path.ptr); |
|
1930
|
0 |
3 |
} else if (is_reinit) { |
|
1931
|
0 |
0 |
if (git_config_delete_entry(config, "core.worktree") < 0) |
|
1936
|
0 |
5 |
if (mode == GIT_REPOSITORY_INIT_SHARED_GROUP) { |
|
1937
|
0 |
0 |
SET_REPO_CONFIG(int32, "core.sharedrepository", 1); |
|
1938
|
0 |
0 |
SET_REPO_CONFIG(bool, "receive.denyNonFastforwards", true); |
|
1940
|
0 |
5 |
else if (mode == GIT_REPOSITORY_INIT_SHARED_ALL) { |
|
1941
|
0 |
0 |
SET_REPO_CONFIG(int32, "core.sharedrepository", 2); |
|
1942
|
0 |
0 |
SET_REPO_CONFIG(bool, "receive.denyNonFastforwards", true); |
|
1973
|
0 |
0 |
if (!(error = repo_local_config(&config, &path, repo, repo_dir))) |
|
1982
|
0 |
0 |
if (!repo->is_bare && recurse) |
|
|
0 |
0 |
if (!repo->is_bare && recurse) |
|
1999
|
0 |
15 |
if (git_str_joinpath(&path, git_dir, file) < 0) |
|
2002
|
0 |
15 |
if (allow_overwrite) |
|
2009
|
15 |
0 |
if (fd >= 0) { |
|
2014
|
0 |
0 |
else if (errno != EEXIST) |
|
2028
|
0 |
15 |
if (error) |
|
2045
|
0 |
0 |
if (git_str_oom(&buf)) |
|
2049
|
0 |
0 |
if (git__suffixcmp(to_repo, "/" DOT_GIT "/") == 0 && |
|
|
0 |
0 |
if (git__suffixcmp(to_repo, "/" DOT_GIT "/") == 0 && |
|
2056
|
0 |
0 |
if ((error = git_str_joinpath(&buf, in_dir, DOT_GIT)) < 0) |
|
2059
|
0 |
0 |
if (!p_stat(buf.ptr, &st) && !S_ISREG(st.st_mode)) { |
|
|
0 |
0 |
if (!p_stat(buf.ptr, &st) && !S_ISREG(st.st_mode)) { |
|
2070
|
0 |
0 |
if (!error && use_relative_path) |
|
|
0 |
0 |
if (!error && use_relative_path) |
|
2073
|
0 |
0 |
if (!error) |
|
2076
|
0 |
0 |
if (!error) |
|
2087
|
10 |
0 |
if (opts->mode == GIT_REPOSITORY_INIT_SHARED_UMASK) |
|
2089
|
0 |
0 |
if (opts->mode == GIT_REPOSITORY_INIT_SHARED_GROUP) |
|
2091
|
0 |
0 |
if (opts->mode == GIT_REPOSITORY_INIT_SHARED_ALL) |
|
2122
|
3 |
2 |
if ((opts->flags & GIT_REPOSITORY_INIT_BARE) == 0 && |
|
|
0 |
3 |
if ((opts->flags & GIT_REPOSITORY_INIT_BARE) == 0 && |
|
2125
|
0 |
0 |
if (repo_write_gitlink(work_dir, repo_dir, opts->flags & GIT_REPOSITORY_INIT_RELATIVE_GITLINK) < 0) |
|
2130
|
0 |
5 |
if (external_tpl) { |
|
2136
|
0 |
0 |
if (opts->template_path) |
|
2138
|
0 |
0 |
else if ((error = git_config_open_default(&cfg)) >= 0) { |
|
2139
|
0 |
0 |
if (!git_config__get_path(&template_buf, cfg, "init.templatedir")) |
|
2144
|
0 |
0 |
if (!tdir) { |
|
2145
|
0 |
0 |
if (!(error = git_sysdir_find_template_dir(&template_buf))) |
|
2156
|
0 |
0 |
if (tdir && git__strcmp(tdir, "") != 0) { |
|
|
0 |
0 |
if (tdir && git__strcmp(tdir, "") != 0) { |
|
2160
|
0 |
0 |
if (opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK) |
|
2173
|
0 |
0 |
if (error < 0) { |
|
2174
|
0 |
0 |
if (!default_template && error != GIT_ENOTFOUND) |
|
|
0 |
0 |
if (!default_template && error != GIT_ENOTFOUND) |
|
2188
|
50 |
0 |
for (tpl = repo_template; !error && tpl->path; ++tpl) { |
|
|
45 |
5 |
for (tpl = repo_template; !error && tpl->path; ++tpl) { |
|
2189
|
30 |
15 |
if (!tpl->content) { |
|
2191
|
0 |
30 |
if (chmod) |
|
2197
|
15 |
0 |
else if (!external_tpl) { |
|
2200
|
0 |
15 |
if (opts->description && strcmp(tpl->path, GIT_DESC_FILE) == 0) |
|
|
0 |
0 |
if (opts->description && strcmp(tpl->path, GIT_DESC_FILE) == 0) |
|
2216
|
0 |
5 |
return git_futils_mkdir( |
|
2257
|
3 |
2 |
(opts->flags & GIT_REPOSITORY_INIT_NO_DOTGIT_DIR) == 0 && |
|
2258
|
3 |
0 |
!is_bare && |
|
2259
|
5 |
0 |
git__suffixcmp(given_repo, "/" DOT_GIT) != 0 && |
|
|
3 |
0 |
git__suffixcmp(given_repo, "/" DOT_GIT) != 0 && |
|
2262
|
3 |
2 |
if (git_str_joinpath(repo_path, given_repo, add_dotgit ? GIT_DIR : "") < 0) |
|
|
0 |
5 |
if (git_str_joinpath(repo_path, given_repo, add_dotgit ? GIT_DIR : "") < 0) |
|
2266
|
3 |
2 |
if (has_dotgit) |
|
2271
|
3 |
2 |
if (!is_bare) { |
|
2272
|
0 |
3 |
if (opts->workdir_path) { |
|
2273
|
0 |
0 |
if (git_fs_path_join_unrooted( |
|
2276
|
3 |
0 |
} else if (has_dotgit) { |
|
2277
|
0 |
3 |
if (git_fs_path_dirname_r(wd_path, repo_path->ptr) < 0) |
|
2285
|
0 |
3 |
if (git_fs_path_to_dir(wd_path) < 0) |
|
2292
|
3 |
0 |
has_dotgit && |
|
2293
|
3 |
0 |
wd_path->size > 0 && |
|
2294
|
3 |
2 |
wd_path->size + strlen(GIT_DIR) == repo_path->size && |
|
|
3 |
0 |
wd_path->size + strlen(GIT_DIR) == repo_path->size && |
|
2296
|
3 |
2 |
if (natural_wd) |
|
2303
|
5 |
0 |
if ((opts->flags & GIT_REPOSITORY_INIT_MKPATH) != 0) { |
|
2305
|
3 |
2 |
if (wd_path->size > 0 && |
|
|
0 |
3 |
if (wd_path->size > 0 && |
|
2310
|
2 |
3 |
if (!natural_wd && |
|
|
0 |
2 |
if (!natural_wd && |
|
2315
|
5 |
0 |
if ((opts->flags & GIT_REPOSITORY_INIT_MKDIR) != 0 || |
|
|
5 |
0 |
if ((opts->flags & GIT_REPOSITORY_INIT_MKDIR) != 0 || |
|
2319
|
3 |
2 |
if (wd_path->size > 0 && |
|
|
0 |
3 |
if (wd_path->size > 0 && |
|
2326
|
2 |
3 |
if (!natural_wd && |
|
|
0 |
2 |
if (!natural_wd && |
|
2333
|
5 |
0 |
if ((opts->flags & GIT_REPOSITORY_INIT_MKDIR) != 0 || |
|
|
0 |
5 |
if ((opts->flags & GIT_REPOSITORY_INIT_MKDIR) != 0 || |
|
2334
|
0 |
0 |
(opts->flags & GIT_REPOSITORY_INIT_MKPATH) != 0 || |
|
2338
|
0 |
5 |
error = git_futils_mkdir(repo_path->ptr, dirmode, |
|
2344
|
5 |
0 |
if (!error) { |
|
2347
|
5 |
0 |
if (!error && wd_path->size > 0) |
|
|
3 |
2 |
if (!error && wd_path->size > 0) |
|
2361
|
0 |
5 |
if ((error = git_str_joinpath(&head_path, repo_dir, GIT_HEAD_FILE)) < 0) |
|
2368
|
0 |
5 |
if (git_fs_path_exists(head_path.ptr) && !given) |
|
|
0 |
0 |
if (git_fs_path_exists(head_path.ptr) && !given) |
|
2371
|
0 |
5 |
if (given) { |
|
2373
|
5 |
0 |
} else if ((error = git_config_open_default(&cfg)) >= 0 && |
|
|
5 |
0 |
} else if ((error = git_config_open_default(&cfg)) >= 0 && |
|
2374
|
5 |
0 |
(error = git_config__get_string_buf(&cfg_branch, cfg, "init.defaultbranch")) >= 0 && |
|
2379
|
0 |
5 |
if (!initial_head) |
|
2397
|
0 |
0 |
if (!(error = git_remote_create(&remote, repo, GIT_REMOTE_ORIGIN, url))) { |
|
2410
|
2 |
3 |
if (is_bare) |
|
2427
|
0 |
5 |
GIT_ASSERT_ARG(out); |
|
2428
|
0 |
5 |
GIT_ASSERT_ARG(given_repo); |
|
2429
|
0 |
5 |
GIT_ASSERT_ARG(opts); |
|
2431
|
0 |
5 |
GIT_ERROR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options"); |
|
2433
|
0 |
5 |
if ((error = repo_init_directories(&repo_path, &wd_path, given_repo, opts)) < 0) |
|
2436
|
3 |
2 |
wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_str_cstr(&wd_path); |
|
2438
|
0 |
5 |
if ((error = is_valid_repository_path(&is_valid, &repo_path, &common_path)) < 0) |
|
2441
|
0 |
5 |
if (is_valid) { |
|
2442
|
0 |
0 |
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) { |
|
2451
|
0 |
0 |
if ((error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0) |
|
2456
|
5 |
0 |
if ((error = repo_init_structure(repo_path.ptr, wd, opts)) < 0 || |
|
|
5 |
0 |
if ((error = repo_init_structure(repo_path.ptr, wd, opts)) < 0 || |
|
2457
|
5 |
0 |
(error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0 || |
|
2462
|
0 |
5 |
if ((error = git_repository_open(out, repo_path.ptr)) < 0) |
|
2465
|
0 |
5 |
if (opts->origin_url && |
|
|
0 |
0 |
if (opts->origin_url && |
|
2483
|
0 |
6 |
if (git_repository_odb__weakptr(&odb, repo) < 0) |
|
2486
|
0 |
6 |
if (git_reference_lookup(&ref, repo, GIT_HEAD_FILE) < 0) |
|
2489
|
2 |
4 |
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) { |
|
2505
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
2506
|
0 |
0 |
GIT_ASSERT_ARG(name); |
|
2508
|
0 |
0 |
if ((error = git_repository_head_for_worktree(&ref, repo, name)) < 0) |
|
2523
|
0 |
265 |
GIT_ASSERT_ARG(head_out); |
|
2525
|
0 |
265 |
if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0) |
|
2528
|
21 |
244 |
if (git_reference_type(head) == GIT_REFERENCE_DIRECT) { |
|
2536
|
229 |
15 |
return error == GIT_ENOTFOUND ? GIT_EUNBORNBRANCH : error; |
|
2546
|
0 |
1 |
GIT_ASSERT_ARG(out); |
|
2547
|
0 |
1 |
GIT_ASSERT_ARG(repo); |
|
2548
|
0 |
1 |
GIT_ASSERT_ARG(name); |
|
2552
|
1 |
0 |
if ((error = git_worktree_lookup(&worktree, repo, name)) < 0 || |
|
|
1 |
0 |
if ((error = git_worktree_lookup(&worktree, repo, name)) < 0 || |
|
2553
|
1 |
0 |
(error = git_repository_open_from_worktree(&worktree_repo, worktree)) < 0 || |
|
2557
|
1 |
0 |
if (git_reference_type(head) != GIT_REFERENCE_DIRECT) { |
|
2558
|
0 |
1 |
if ((error = git_reference_lookup_resolved(out, worktree_repo, git_reference_symbolic_target(head), -1)) < 0) |
|
2585
|
0 |
18 |
if (!repo->commondir) |
|
2595
|
0 |
18 |
if ((error = git_worktree_list(&worktrees, repo)) < 0) |
|
2598
|
0 |
18 |
for (i = 0; i < worktrees.count; i++) { |
|
2604
|
0 |
0 |
if ((error = git_worktree_lookup(&worktree, repo, worktrees.strings[i]) < 0) || |
|
|
0 |
0 |
if ((error = git_worktree_lookup(&worktree, repo, worktrees.strings[i]) < 0) || |
|
2606
|
0 |
0 |
if (error != GIT_ENOTFOUND) |
|
2612
|
0 |
0 |
if ((error = cb(worktree_repo, payload)) != 0) |
|
2631
|
0 |
0 |
if (error == GIT_EUNBORNBRANCH) { |
|
2636
|
0 |
0 |
if (error < 0) |
|
2648
|
0 |
2 |
if ((error = git_reference_iterator_new(&iter, repo)) < 0) |
|
2654
|
2 |
0 |
if (error == GIT_ITEROVER) |
|
2667
|
0 |
2 |
if ((error = git_repository_config__weakptr(&config, repo)) < 0) |
|
2670
|
2 |
0 |
if ((error = git_config_get_entry(&entry, config, "init.defaultbranch")) == 0 && |
|
|
2 |
0 |
if ((error = git_config_get_entry(&entry, config, "init.defaultbranch")) == 0 && |
|
2674
|
0 |
0 |
else if (!error || error == GIT_ENOTFOUND) { |
|
|
0 |
0 |
else if (!error || error == GIT_ENOTFOUND) { |
|
2681
|
2 |
0 |
if ((error = git_str_puts(out, GIT_REFS_HEADS_DIR)) < 0 || |
|
|
2 |
0 |
if ((error = git_str_puts(out, GIT_REFS_HEADS_DIR)) < 0 || |
|
2682
|
2 |
0 |
(error = git_str_puts(out, branch)) < 0 || |
|
2686
|
0 |
2 |
if (!valid) { |
|
2702
|
2 |
0 |
if ((result = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0 || |
|
|
2 |
0 |
if ((result = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0 || |
|
2706
|
2 |
0 |
result = (git_reference_type(head) == GIT_REFERENCE_SYMBOLIC && |
|
2707
|
2 |
0 |
strcmp(git_reference_symbolic_target(head), initialbranch.ptr) == 0 && |
|
|
2 |
0 |
strcmp(git_reference_symbolic_target(head), initialbranch.ptr) == 0 && |
|
2735
|
0 |
1428 |
if (!parent && fallback != GIT_REPOSITORY_ITEM__LAST) |
|
|
0 |
0 |
if (!parent && fallback != GIT_REPOSITORY_ITEM__LAST) |
|
2746
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_repository__item_path, repo, item); |
|
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_repository__item_path, repo, item); |
|
2755
|
0 |
1428 |
if (parent == NULL) { |
|
2760
|
0 |
1428 |
if (git_str_sets(out, parent) < 0) |
|
2763
|
1428 |
0 |
if (items[item].name) { |
|
2764
|
0 |
1428 |
if (git_str_joinpath(out, parent, items[item].name) < 0) |
|
2768
|
1365 |
63 |
if (items[item].directory) { |
|
2769
|
0 |
1365 |
if (git_fs_path_to_dir(out) < 0) |
|
2778
|
0 |
30 |
GIT_ASSERT_ARG_WITH_RETVAL(repo, NULL); |
|
2784
|
0 |
7555 |
GIT_ASSERT_ARG_WITH_RETVAL(repo, NULL); |
|
2786
|
0 |
7555 |
if (repo->is_bare) |
|
2797
|
0 |
912 |
if (!repo->workdir) { |
|
2802
|
912 |
0 |
if (!(error = git_str_joinpath(out, repo->workdir, path))) |
|
2810
|
0 |
1431 |
GIT_ASSERT_ARG_WITH_RETVAL(repo, NULL); |
|
2820
|
0 |
2 |
GIT_ASSERT_ARG(repo); |
|
2821
|
0 |
2 |
GIT_ASSERT_ARG(workdir); |
|
2823
|
0 |
2 |
if (git_fs_path_prettify_dir(&path, workdir, NULL) < 0) |
|
2826
|
2 |
0 |
if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0) |
|
|
2 |
0 |
if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0) |
|
2829
|
0 |
0 |
if (update_gitlink) { |
|
2832
|
0 |
0 |
if (git_repository_config__weakptr(&config, repo) < 0) |
|
2838
|
0 |
0 |
if (error == GIT_PASSTHROUGH) |
|
2840
|
0 |
0 |
else if (!error) |
|
2843
|
0 |
0 |
if (!error) |
|
2847
|
0 |
0 |
if (!error) { |
|
2861
|
0 |
997 |
GIT_ASSERT_ARG(repo); |
|
2867
|
0 |
2 |
GIT_ASSERT_ARG(repo); |
|
2876
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
2878
|
0 |
0 |
if (repo->is_bare) |
|
2881
|
0 |
0 |
if ((error = git_repository_config__weakptr(&config, repo)) < 0) |
|
2884
|
0 |
0 |
if ((error = git_config_set_bool(config, "core.bare", true)) < 0) |
|
2887
|
0 |
0 |
if ((error = git_config__update_entry(config, "core.worktree", NULL, true, true)) < 0) |
|
2903
|
14 |
86 |
if ((error = git_repository_head(&head, repo)) < 0) |
|
2906
|
0 |
86 |
if ((error = git_reference_peel(&obj, head, GIT_OBJECT_TREE)) < 0) |
|
2925
|
7 |
0 |
if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 && |
|
|
7 |
0 |
if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 && |
|
2926
|
7 |
0 |
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) == 0 && |
|
2930
|
0 |
7 |
if (error < 0) |
|
2944
|
0 |
1 |
if (git_str_joinpath(&path, repo->gitdir, GIT_MERGE_MSG_FILE) < 0) |
|
2947
|
0 |
1 |
if ((error = p_stat(git_str_cstr(&path), &st)) < 0) { |
|
2948
|
0 |
0 |
if (errno == ENOENT) |
|
2962
|
1 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_repository__message, repo); |
|
|
1 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_repository__message, repo); |
|
2970
|
0 |
0 |
if (git_str_joinpath(&path, repo->gitdir, GIT_MERGE_MSG_FILE) < 0) |
|
2994
|
0 |
0 |
GIT_ASSERT_ARG(out); |
|
2995
|
0 |
0 |
GIT_ASSERT_ARG(path); |
|
2996
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
2998
|
0 |
0 |
if ((error = git_fs_path_join_unrooted(&full_path, path, workdir, NULL)) < 0 || |
|
|
0 |
0 |
if ((error = git_fs_path_join_unrooted(&full_path, path, workdir, NULL)) < 0 || |
|
3006
|
0 |
0 |
if (!as_path) { |
|
3007
|
0 |
0 |
if (workdir && !git__prefixcmp(full_path.ptr, workdir)) |
|
|
0 |
0 |
if (workdir && !git__prefixcmp(full_path.ptr, workdir)) |
|
3014
|
0 |
0 |
if (strlen(as_path) > 0) { |
|
3019
|
0 |
0 |
if (error < 0) |
|
3026
|
0 |
0 |
if (fd < 0) { |
|
3031
|
0 |
0 |
if ((error = git_futils_filesize(&len, fd)) < 0) |
|
3034
|
0 |
0 |
if (!git__is_sizet(len)) { |
|
3043
|
0 |
0 |
if (fd >= 0) |
|
3055
|
19 |
1 |
if (git_reference_type(old) == GIT_REFERENCE_SYMBOLIC) |
|
3063
|
0 |
1 |
git_reference__is_tag(new) || |
|
3069
|
0 |
20 |
if (git_str_oom(out)) |
|
3082
|
0 |
1 |
GIT_ASSERT_ARG(repo); |
|
3083
|
0 |
1 |
GIT_ASSERT_ARG(id); |
|
3085
|
0 |
1 |
if ((error = git_reference_lookup(¤t, repo, GIT_HEAD_FILE)) < 0) |
|
3088
|
0 |
1 |
if ((error = git_object_lookup(&object, repo, id, GIT_OBJECT_ANY)) < 0) |
|
3091
|
0 |
1 |
if ((error = git_object_peel(&peeled, object, GIT_OBJECT_COMMIT)) < 0) |
|
3094
|
1 |
0 |
if (new == NULL) |
|
3097
|
0 |
1 |
if ((error = checkout_message(&log_message, current, new)) < 0) |
|
3119
|
0 |
19 |
GIT_ASSERT_ARG(repo); |
|
3120
|
0 |
19 |
GIT_ASSERT_ARG(refname); |
|
3122
|
0 |
19 |
if ((error = git_reference_lookup(¤t, repo, GIT_HEAD_FILE)) < 0) |
|
3125
|
0 |
19 |
if ((error = checkout_message(&log_message, current, refname)) < 0) |
|
3129
|
0 |
19 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
3132
|
19 |
0 |
if (ref && current->type == GIT_REFERENCE_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) && |
|
|
18 |
1 |
if (ref && current->type == GIT_REFERENCE_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) && |
|
3133
|
0 |
17 |
git_reference_is_branch(ref) && git_branch_is_checked_out(ref)) { |
|
3140
|
19 |
0 |
if (!error) { |
|
3141
|
19 |
0 |
if (git_reference_is_branch(ref)) { |
|
3145
|
0 |
0 |
error = detach(repo, git_reference_target(ref), |
|
3146
|
0 |
0 |
git_reference_is_tag(ref) || git_reference_is_remote(ref) ? refname : NULL); |
|
3148
|
0 |
0 |
} else if (git_reference__is_branch(refname)) { |
|
3172
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
3173
|
0 |
0 |
GIT_ASSERT_ARG(committish); |
|
3185
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
3187
|
0 |
0 |
if ((error = git_reference_lookup(¤t, repo, GIT_HEAD_FILE)) < 0) |
|
3190
|
0 |
0 |
if ((error = git_repository_head(&old_head, repo)) < 0) |
|
3193
|
0 |
0 |
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJECT_COMMIT)) < 0) |
|
3196
|
0 |
0 |
if ((error = checkout_message(&log_message, current, git_oid_tostr_s(git_object_id(object)))) < 0) |
|
3220
|
0 |
37 |
GIT_ASSERT_ARG(repo); |
|
3222
|
0 |
37 |
if (git_str_puts(&repo_path, repo->gitdir) < 0) |
|
3225
|
1 |
36 |
if (git_fs_path_contains_file(&repo_path, GIT_REBASE_MERGE_INTERACTIVE_FILE)) |
|
3227
|
3 |
33 |
else if (git_fs_path_contains_dir(&repo_path, GIT_REBASE_MERGE_DIR)) |
|
3229
|
1 |
32 |
else if (git_fs_path_contains_file(&repo_path, GIT_REBASE_APPLY_REBASING_FILE)) |
|
3231
|
1 |
31 |
else if (git_fs_path_contains_file(&repo_path, GIT_REBASE_APPLY_APPLYING_FILE)) |
|
3233
|
1 |
30 |
else if (git_fs_path_contains_dir(&repo_path, GIT_REBASE_APPLY_DIR)) |
|
3235
|
4 |
26 |
else if (git_fs_path_contains_file(&repo_path, GIT_MERGE_HEAD_FILE)) |
|
3237
|
2 |
24 |
else if (git_fs_path_contains_file(&repo_path, GIT_REVERT_HEAD_FILE)) { |
|
3239
|
0 |
2 |
if (git_fs_path_contains_file(&repo_path, GIT_SEQUENCER_TODO_FILE)) { |
|
3242
|
3 |
21 |
} else if (git_fs_path_contains_file(&repo_path, GIT_CHERRYPICK_HEAD_FILE)) { |
|
3244
|
0 |
3 |
if (git_fs_path_contains_file(&repo_path, GIT_SEQUENCER_TODO_FILE)) { |
|
3247
|
1 |
20 |
} else if (git_fs_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE)) |
|
3261
|
193 |
0 |
for (error = 0, i = 0; !error && i < files_len; ++i) { |
|
|
173 |
20 |
for (error = 0, i = 0; !error && i < files_len; ++i) { |
|
3264
|
0 |
173 |
if (git_str_joinpath(&buf, repo->gitdir, files[i]) < 0) |
|
3269
|
25 |
148 |
if (git_fs_path_isfile(path)) { |
|
3271
|
6 |
142 |
} else if (git_fs_path_isdir(path)) { |
|
3297
|
0 |
19 |
GIT_ASSERT_ARG(repo); |
|
3308
|
0 |
0 |
if ((error = git_str_joinpath(&path, repo->gitdir, "shallow")) < 0) |
|
3314
|
0 |
0 |
if (error == GIT_ENOTFOUND) { |
|
3319
|
0 |
0 |
if (error < 0) |
|
3327
|
0 |
0 |
GIT_INIT_STRUCTURE_FROM_TEMPLATE( |
|
3353
|
0 |
0 |
if (name) { |
|
3355
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(tmp_name); |
|
3358
|
0 |
0 |
if (email) { |
|
3360
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(tmp_email); |
|
3374
|
0 |
0 |
GIT_ASSERT_ARG(repo); |
|
3381
|
0 |
63 |
GIT_ASSERT_ARG(repo); |