git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: pclouds@gmail.com
Cc: git@vger.kernel.org, sunshine@sunshineco.com,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 2/3] worktree: delete dead code
Date: Thu, 15 Mar 2018 17:44:11 +0100	[thread overview]
Message-ID: <20180315164412.14697-3-pclouds@gmail.com> (raw)
In-Reply-To: <20180315164412.14697-1-pclouds@gmail.com>

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>
---
 Documentation/gitrepository-layout.txt | 5 -----
 builtin/worktree.c                     | 8 --------
 2 files changed, 13 deletions(-)

diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
index c60bcad44a..e85148f05e 100644
--- a/Documentation/gitrepository-layout.txt
+++ b/Documentation/gitrepository-layout.txt
@@ -275,11 +275,6 @@ worktrees/<id>/locked::
 	or manually by `git worktree prune`. The file may contain a string
 	explaining why the repository is locked.
 
-worktrees/<id>/link::
-	If this file exists, it is a hard link to the linked .git
-	file. It is used to detect if the linked repository is
-	manually removed.
-
 SEE ALSO
 --------
 linkgit:git-init[1],
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 670555dedd..e55edf2aa5 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -101,15 +101,7 @@ static int prune_worktree(const char *id, struct strbuf *reason)
 	}
 	path[len] = '\0';
 	if (!file_exists(path)) {
-		struct stat st_link;
 		free(path);
-		/*
-		 * the repo is moved manually and has not been
-		 * accessed since?
-		 */
-		if (!stat(git_path("worktrees/%s/link", id), &st_link) &&
-		    st_link.st_nlink > 1)
-			return 0;
 		if (st.st_mtime <= expire) {
 			strbuf_addf(reason, _("Removing worktrees/%s: gitdir file points to non-existent location"), id);
 			return 1;
-- 
2.16.2.903.gd04caf5039


  parent reply	other threads:[~2018-03-15 16:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  3:39 [PATCH 0/3] git worktree prune improvements Nguyễn Thái Ngọc Duy
2018-03-03  3:39 ` [PATCH 1/3] gc.txt: more details about what gc does Nguyễn Thái Ngọc Duy
2018-03-03  9:14   ` Eric Sunshine
2018-03-03  3:39 ` [PATCH 2/3] worktree: delete dead code Nguyễn Thái Ngọc Duy
2018-03-03  3:39 ` [PATCH 3/3] worktree prune: improve prune logic when worktree is moved Nguyễn Thái Ngọc Duy
2018-03-03  9:30   ` Eric Sunshine
2018-03-03 14:21 ` [PATCH 0/3] git worktree prune improvements Randall S. Becker
2018-03-05 12:16   ` Duy Nguyen
2018-03-15 16:44 ` [PATCH v2 " Nguyễn Thái Ngọc Duy
2018-03-15 16:44   ` [PATCH v2 1/3] gc.txt: more details about what gc does Nguyễn Thái Ngọc Duy
2018-03-15 16:44   ` Nguyễn Thái Ngọc Duy [this message]
2018-03-18 22:51     ` [PATCH v2 2/3] worktree: delete dead code Eric Sunshine
2018-03-15 16:44   ` [PATCH v2 3/3] worktree prune: improve prune logic when worktree is moved Nguyễn Thái Ngọc Duy
2018-03-18 22:59     ` Eric Sunshine
2018-03-18 23:02   ` [PATCH v2 0/3] git worktree prune improvements Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180315164412.14697-3-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).