diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-01-22 15:35:49 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-01-22 14:28:42 -0800 |
commit | 618244e160cb0777bc8d41055f7de0192b10ea0f (patch) | |
tree | b414b7f5842a0b09ac307982a190649aa8492c0b /setup.c | |
parent | d4cddd66d7ab620fe449ab01382b27178c908c10 (diff) | |
download | git-618244e160cb0777bc8d41055f7de0192b10ea0f.tar.gz |
worktree: stop supporting moving worktrees manuallynd/do-not-move-worktree-manually
The current update_linked_gitdir() has a bug that can create "gitdir"
file in non-multi-worktree setup. Worse, sometimes it can write relative
path to "gitdir" file, which will not work (e.g. "git worktree list"
will display the worktree's location incorrectly)
Instead of fixing this, we step back a bit. The original design was
probably not well thought out. For now, if the user manually moves a
worktree, they have to fix up "gitdir" file manually or the worktree
will get pruned.
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 12 |
1 files changed, 0 insertions, 12 deletions
@@ -401,17 +401,6 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok) return ret; } -static void update_linked_gitdir(const char *gitfile, const char *gitdir) -{ - struct strbuf path = STRBUF_INIT; - struct stat st; - - strbuf_addf(&path, "%s/gitdir", gitdir); - if (stat(path.buf, &st) || st.st_mtime + 24 * 3600 < time(NULL)) - write_file(path.buf, "%s", gitfile); - strbuf_release(&path); -} - /* * Try to read the location of the git directory from the .git file, * return path to git directory if found. @@ -481,7 +470,6 @@ const char *read_gitfile_gently(const char *path, int *return_error_code) error_code = READ_GITFILE_ERR_NOT_A_REPO; goto cleanup_return; } - update_linked_gitdir(path, dir); path = real_path(dir); cleanup_return: |