diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-04-10 08:25:45 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-10 08:25:45 +0900 |
commit | ca923f72653f5bfc61933ee334ca5fe34d4fe5f0 (patch) | |
tree | 2e0439f6b79469bc996b273270891e0cc0b332e6 /builtin | |
parent | a5bbc29994b22ab0b57c4dc9568a261d32476e94 (diff) | |
parent | 327864aaf76d000ee5d7722b9b9611ed7a2708f5 (diff) | |
download | git-ca923f72653f5bfc61933ee334ca5fe34d4fe5f0.tar.gz |
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')
-rw-r--r-- | builtin/worktree.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c index ba2cb877c3..40a438ed6c 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 { |