| 2656 | } |
| 2657 | |
| 2658 | static 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 | |
| 2680 | struct default_format_config { |
| 2681 | int hash; |
no test coverage detected