"git prune" relies on "git rev-list --all" to list all reachable, non-prunable commits. In the presence of per-worktree refs such as HEAD this becomes more complicated. Add a test that makes sure that per-worktree refs from other worktrees are not omitted. This is currently broken, possibly resulting in data loss. Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> --- t/t6014-rev-list-all.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/t6014-rev-list-all.sh b/t/t6014-rev-list-all.sh index c9bedd2..99bf8ae 100755 --- a/t/t6014-rev-list-all.sh +++ b/t/t6014-rev-list-all.sh @@ -39,4 +39,29 @@ test_expect_success 'rev-list --graph --no-walk is forbidden' ' test_must_fail git rev-list --graph --no-walk HEAD ' +test_expect_success 'setup worktree tests' ' + mkdir newtree && + git worktree add --detach newtree master^ && + ( + cd newtree && + commit detached2 + ) +' + +test_expect_failure 'prune in main worktree does not lose detached HEAD in new worktree' ' + git prune --expire=now && + ( + cd newtree && + git show HEAD + ) +' + +test_expect_failure 'prune in new worktree does not lose detached HEAD in main worktree' ' + ( + cd newtree && + git prune --expire=now + ) && + git show HEAD +' + test_done -- 2.7.2.618.g7a61b68 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html