* Note. This works only before you used a work tree. This was added * primarily to support git-clone to work in a new repository it just * created, and is not meant to flip between different work trees. */
| 1902 | * created, and is not meant to flip between different work trees. |
| 1903 | */ |
| 1904 | void set_git_work_tree(struct repository *repo, const char *new_work_tree) |
| 1905 | { |
| 1906 | if (repo->worktree_initialized) { |
| 1907 | struct strbuf realpath = STRBUF_INIT; |
| 1908 | |
| 1909 | strbuf_realpath(&realpath, new_work_tree, 1); |
| 1910 | new_work_tree = realpath.buf; |
| 1911 | if (strcmp(new_work_tree, repo->worktree)) |
| 1912 | die("internal error: work tree has already been set\n" |
| 1913 | "Current worktree: %s\nNew worktree: %s", |
| 1914 | repo->worktree, new_work_tree); |
| 1915 | strbuf_release(&realpath); |
| 1916 | return; |
| 1917 | } |
| 1918 | repo->worktree_initialized = true; |
| 1919 | repo_set_worktree(repo, new_work_tree); |
| 1920 | } |
| 1921 | |
| 1922 | const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok) |
| 1923 | { |
no test coverage detected