Re: [PATCH] diffcore-rename: favour identical basenames
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:17
Linus Torvalds [off-list ref] writes:
We'e also had things like arch/i386/kernel/pci-pc.c -> arch/i386/kernel/pci/common.c so it's not always the ending of a file that is unchanged, but you still often have some "similarity" of the name (ie the "pci" substring is still common there).
This is not an example to draw very useful conclusions, is it?
The heuristics to say '-pc => common' is a more likely rename
than '-obscure-arch => common' heavily depends on human
intelligence in the context of a particular project, the kernel,
where there are rules such as "peripherals are tested most
widely on PC architectures, so assume that the vendors might
have tested their stuff only on PCs".
But I do agree that not limiting to basename has values.
Taking example from the "I cannot draw so here is a red big X",
it is quite possible that two red big X's are replaced with
properly rendered icons, while their format modified, like so:
images/ok-button.gif => images/buttons/ok.png
images/cancel-button.gif => images/buttons/cancel.png
This suggests that we might be able to look around to see what
other rename src/target candidate files there are, so that we
can figure out if there is a common pattern (i.e. in the above
example, "patsubst images/%-button.gif,images/buttons/%.png" is
what is going on). If we find such a pattern, we can base the
assignment of "basename similarity bonus" on that pattern.