Re: renormalize histroy with smudge/clean-filter
From: Junio C Hamano <hidden>
Date: 2025-02-06 19:00:38
Elijah Newren [off-list ref] writes:
I kind of think we need a way to ask git "how would renormalization modify this buffer if it were at this path" short of creating a full index and checkout.
That makes it sound as if you are asking for "diff/patch" between
pre- and post- renormalization operation, but wouldn't the question
be more like "pretend this buffer content were at this path in a
checkout of this tree-ish. Now compute what 'git add --renormalize'
would give us for that path".
What would it take?
- An equivalent of the in-core index (but you need to specify from
which tree-ish it should be taken from) so that you can learn
what attributes are attached to the path in question. You may
want to grab`filter`, `ident`, `working-tree-encoding`, etc. out
of the attribute subsystem.
- Access to the "config" data, to learn what exact commands to
spawn to filter the buffer for, and what encoding and line
terminating conventions are used for given path. You may want to
grab values of "filter.<name>.{clean,smudge}", "core.eol", etc.,
for example.
- A sandbox to safely run these external commands needed for
smudge/clean filters.
It does not sound entirely trivial, but it does not look too much
of recket science, either.