worktree: delete dead code

This "link" was a feature in early iterations of multiple worktree functionality for some reason it was dropped [1]. Since nobody creates this "link", there's no need to check it. This is mostly used to let the user moves a worktree manually [2]. If you move a worktree within the same file system, this hard link count lets us know the worktree is still there even if we don't know where it is. We support 'worktree move' now and don't need this anymore. [1] last appearance in v4 message-id: 1393675983-3232-25-git-send-email-pclouds@gmail.com and the reason in v5 was "revisit later", message-id: 1394246900-31535-1-git-send-email-pclouds@gmail.com [2] 23af91d102 (prune: strategies for linked checkouts - 2014-11-30) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Mar 15, 2018 at 17:44 UTC 3800135b8955cd9bf43c8599e6d41774a0e8e986
2 files changed -13
Documentation/gitrepository-layout.txt
-5
@@ -275,11 +275,6 @@ worktrees/<id>/locked::
275 or manually by `git worktree prune`. The file may contain a string
276 explaining why the repository is locked.
277
278 -worktrees/<id>/link::
279 - If this file exists, it is a hard link to the linked .git
280 - file. It is used to detect if the linked repository is
281 - manually removed.
282 -
278 SEE ALSO
279 --------
280 linkgit:git-init[1],
builtin/worktree.c
-8
@@ -99,15 +99,7 @@ static int prune_worktree(const char *id, struct strbuf *reason)
99 }
100 path[len] = '\0';
101 if (!file_exists(path)) {
102 - struct stat st_link;
102 free(path);
104 - /*
105 - * the repo is moved manually and has not been
106 - * accessed since?
107 - */
108 - if (!stat(git_path("worktrees/%s/link", id), &st_link) &&
109 - st_link.st_nlink > 1)
110 - return 0;
103 if (st.st_mtime <= expire) {
104 strbuf_addf(reason, _("Removing worktrees/%s: gitdir file points to non-existent location"), id);
105 return 1;