Re: [PATCH] diffcore-rename: favour identical basenames
- From
Jeff King <peff@peff.net>
- Date
- Jun 21, 2007, 13:19 UTC
- Message-ID
- <20070621131915.GD4487@coredump.intra.peff.net>
- In-Reply-To
- <Pine.LNX.4.64.0706211248420.4059@racer.site>
On Thu, Jun 21, 2007 at 12:52:11PM +0100, Johannes Schindelin wrote:
> When there are several candidates for a rename source, and one of them > has an identical basename to the rename target, take that one.
That's a reasonable heuristic, but it unfortunately won't match simple things like:
i386_widget.c -> arch/i386/widget.c
You really don't care about "is this a good match" as much as providing an order to potential matches. I think something like a Levenshtein distance between the full pathnames would give good results, and would cover almost every situation that the basename heuristic would (there are a few exceptions, like getting "file.c" from either "file2.c" or "foo/file.c", but that seems kind of pathological).
Sorry to post without a patch, but I don't have time right this second. I'll add it to the end of my (ever-growing) todo list if you think it's a good idea and don't do it yourself. :)
-Peff