MCPcopy Index your code
hub / github.com/git/git / separate_git_dir

Function separate_git_dir

setup.c:2658–2678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2656}
2657
2658static void separate_git_dir(const char *git_dir, const char *git_link)
2659{
2660 struct stat st;
2661
2662 if (!stat(git_link, &st)) {
2663 const char *src;
2664
2665 if (S_ISREG(st.st_mode))
2666 src = read_gitfile(git_link);
2667 else if (S_ISDIR(st.st_mode))
2668 src = git_link;
2669 else
2670 die(_("unable to handle file type %d"), (int)st.st_mode);
2671
2672 if (rename(src, git_dir))
2673 die_errno(_("unable to move %s to %s"), src, git_dir);
2674 repair_worktrees_after_gitdir_move(src);
2675 }
2676
2677 write_file(git_link, "gitdir: %s", git_dir);
2678}
2679
2680struct default_format_config {
2681 int hash;

Callers 1

init_dbFunction · 0.85

Calls 5

die_errnoFunction · 0.85
write_fileFunction · 0.85
statClass · 0.70
dieFunction · 0.70

Tested by

no test coverage detected