summaryrefslogtreecommitdiff
path: root/builtin/worktree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-04-09 23:25:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-09 23:25:45 (GMT)
commitca923f72653f5bfc61933ee334ca5fe34d4fe5f0 (patch)
tree2e0439f6b79469bc996b273270891e0cc0b332e6 /builtin/worktree.c
parenta5bbc29994b22ab0b57c4dc9568a261d32476e94 (diff)
parent327864aaf76d000ee5d7722b9b9611ed7a2708f5 (diff)
downloadgit-ca923f72653f5bfc61933ee334ca5fe34d4fe5f0.zip
git-ca923f72653f5bfc61933ee334ca5fe34d4fe5f0.tar.gz
git-ca923f72653f5bfc61933ee334ca5fe34d4fe5f0.tar.bz2
Merge branch 'nd/worktree-prune'
The way "git worktree prune" worked internally has been simplified, by assuming how "git worktree move" moves an existing worktree to a different place. * nd/worktree-prune: worktree prune: improve prune logic when worktree is moved worktree: delete dead code gc.txt: more details about what gc does
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index ba2cb87..40a438e 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -101,16 +101,9 @@ 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) {
+ if (stat(git_path("worktrees/%s/index", id), &st) ||
+ st.st_mtime <= expire) {
strbuf_addf(reason, _("Removing worktrees/%s: gitdir file points to non-existent location"), id);
return 1;
} else {