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

Re: git log --follow

From
Jeff King <peff@peff.net>
Date
Nov 4, 2010, 03:18 UTC
Message-ID
<20101104031827.GA20772@sigill.intra.peff.net>
In-Reply-To
<AANLkTinEEtfxu=NbaGn=A88MrU7JCFztMzB-x3--FCdB@mail.gmail.com>
On Wed, Nov 03, 2010 at 08:00:23PM -0700, Scott Chacon wrote:
> Is there any way to get 'git log --follow' to respect the -M[num]
> option?  If I want to lower the boundary for rename detection when
> printing file history, is there any way to do that?  It doesn't seem
> to work if I just list them both.
No. But this patch would do it.
diff --git a/tree-diff.c b/tree-diff.c
index 12c9a88..378f049 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -351,6 +351,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
 	diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
 	diff_opts.single_follow = opt->paths[0];
 	diff_opts.break_opt = opt->break_opt;
+	diff_opts.rename_score = opt->rename_score;
 	paths[0] = NULL;
 	diff_tree_setup_paths(paths, &diff_opts);
 	if (diff_setup_done(&diff_opts) < 0)

You can see the difference with:

  $ git log --oneline --follow --name-status \
    Documentation/technical/api-string-list.txt
  1d2f80f string_list: Fix argument order for string_list_append
  M       Documentation/technical/api-string-list.txt
  e242148 string-list: add unsorted_string_list_lookup()
  M       Documentation/technical/api-string-list.txt
  0dda1d1 Fix two leftovers from path_list->string_list
  M       Documentation/technical/api-string-list.txt
  c455c87 Rename path_list to string_list
  A       Documentation/technical/api-string-list.txt

  $ git log -M40 --oneline --follow --name-status \
    Documentation/technical/api-string-list.txt
  1d2f80f string_list: Fix argument order for string_list_append
  M       Documentation/technical/api-string-list.txt
  e242148 string-list: add unsorted_string_list_lookup()
  M       Documentation/technical/api-string-list.txt
  0dda1d1 Fix two leftovers from path_list->string_list
  M       Documentation/technical/api-string-list.txt
  c455c87 Rename path_list to string_list
  R047    Documentation/technical/api-path-list.txt
  Documentation/technical/api-string-list.txt
  328a475 path-list documentation: document all functions and data structures
  M       Documentation/technical/api-path-list.txt
  530e741 Start preparing the API documents.
  A       Documentation/technical/api-path-list.txt

I think it's probably something we should be doing (as you can see, we
already copy the break_opt).

-Peff
Previous: Scott Chacon
Message 2 of 2 in “git log --follow”
  1. Scott ChaconNov 4, 2010
  2. Jeff KingNov 4, 2010

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.