git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git blame not respecting --find-copies-harder ?

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 31, 2008, 07:05 UTC
Message-ID
<7vfxpq3559.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080731064814.GA32431@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 15 quoted lines
> On Wed, Jul 30, 2008 at 05:43:52PM +0200, Sverre Rabbelier wrote:
>
>> On Wed, Jul 30, 2008 at 17:01, Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
>> > git blame doesn't know --find-copies-harder, it's -C -C for blame.
>> 
>> Shouldn't it have died with "don't know option --find-copies-harder" then?
>
> Unfortunately, it _does_ know --find-copies-harder, because unknown
> options get sent to the revision option parser, which chains to the diff
> option parser. So it recognizes --find-copies-harder, but just sets a
> flag that doesn't do what we expect.
>
> I'm not sure if there is a simple fix. Does blame actually need the diff
> option parsing? If not, then we might be able to pass a flag to
> parse_revision_opt that says "don't do diff options, too".
Sigh...

We can probably pick up the result revision parser parsed out of revs.diffopt, and then tweak "opt" with it, perhaps like this.

 builtin-blame.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index 8b6b09b..4ea3431 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2346,6 +2346,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 parse_done:
 	argc = parse_options_end(&ctx);
 
+	if (DIFF_OPT_TST(&revs.diffopt, FIND_COPIES_HARDER))
+		opt |= (PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE |
+			PICKAXE_BLAME_COPY_HARDER);
+
 	if (!blame_move_score)
 		blame_move_score = BLAME_DEFAULT_MOVE_SCORE;
 	if (!blame_copy_score)
Previous: Jeff KingNext: Jeff King
Message 5 of 17 in “git blame not respecting --find-copies-harder ?”
  1. Stephen R. van den BergJul 30, 2008
  2. Björn SteinbrinkJul 30, 2008
  3. Sverre RabbelierJul 30, 2008
  4. Jeff KingJul 31, 2008
  5. Junio C HamanoJul 31, 2008
  6. Jeff KingJul 31, 2008
  7. Junio C HamanoJul 31, 2008
  8. Jeff KingJul 31, 2008
  9. Junio C HamanoJul 31, 2008
  10. Pierre HabouzitJul 31, 2008
  11. Jeff KingJul 31, 2008
  12. Pierre HabouzitJul 31, 2008
  13. Jeff KingJul 31, 2008
  14. Pierre HabouzitJul 31, 2008
  15. Jeff KingJul 31, 2008
  16. Pierre HabouzitJul 31, 2008
  17. Jeff KingJul 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.