worktree: generalize delete_git_dir() to reduce code duplication
commit602aaed03f7f82323d88703d6fa2263a13c37907
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 28 Aug 2018 21:20:20 +0000 (28 17:20 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Aug 2018 16:28:02 +0000 (30 09:28 -0700)
tree5e54b90300d883edd7f4170ffa25533b004436bb
parente5353bef550d91655b3f8fb443a26c0ba209153f
worktree: generalize delete_git_dir() to reduce code duplication

prune_worktrees() and delete_git_dir() both remove worktree
administrative entries from .git/worktrees, and their implementations
are nearly identical. The only difference is that prune_worktrees() is
also capable of removing a bogus non-worktree-related file from
.git/worktrees.

Simplify by extending delete_git_dir() to handle the little bit of
extra functionality needed by prune_worktrees(), and drop the
effectively duplicate code from the latter.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c