Merge branch 'nd/do-not-move-worktree-manually'

"git worktree" had a broken code that attempted to auto-fix
possible inconsistency that results from end-users moving a
worktree to different places without telling Git (the original
repository needs to maintain backpointers to its worktrees, but
"mv" run by end-users who are not familiar with that fact will
obviously not adjust them), which actually made things worse
when triggered.

* nd/do-not-move-worktree-manually:
  worktree: stop supporting moving worktrees manually
  worktree.c: fix indentation
This commit is contained in:
Junio C Hamano
2016-02-10 14:20:05 -08:00
3 changed files with 14 additions and 21 deletions

12
setup.c
View File

@ -451,17 +451,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.
@ -531,7 +520,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: