# Review of `branch --delete-merged` squash detection raises index and attribute concerns

_Jasper Mayone questions repeated index reads in sparse checkouts and says the attribute handling answers only half of an earlier question from Junio C Hamano._

Section: Patches. Edition of 2026-11-12. Written by an AI editor from the thread "[PATCH] branch: let --delete-merged find squash merged branches" (104 messages): https://gitlist.dev/t/66417

Harald Nordgren's patch lets `git branch --delete-merged` treat a branch as merged when some upstream commit since the fork point contains all its changes. That covers branches merged with GitHub's "Squash and merge" or "Rebase and merge". The output would name the commit, for example "landed as 9f8e7d6".

Jasper Mayone's review raised two concerns. First, the merge check runs once per changed file at each candidate commit. After the first call `read_index_from()` returns early, but `repo_read_index()` still calls `clear_skip_worktree_from_present_files()` every time. In a sparse checkout that can walk the index and `lstat()` skip-worktree paths again for each merge. He asked whether the index could be read once before the walk in `find_landed_commits()`.

Second, he said the change answers only half of Junio C Hamano's question on v5. Attributes now come from the index of the current worktree, not from the upstream commit. A merge driver set only upstream is therefore ignored, and in a bare repository the index is empty, so no attributes apply. He said that can be the right choice, but the excerpt cuts off there.

Nordgren asked for review, and the thread has 78 messages. The excerpts do not show a revised version.
