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

Re: [PATCH] Documentation/git-blame.txt: --follow is a NO-OP

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 19, 2012, 19:36 UTC
Message-ID
<7vzk4lg5yf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120919182715.GF11699@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 36 quoted lines
> On Tue, Sep 18, 2012 at 09:38:32PM -0700, Junio C Hamano wrote:
>
>> That is a totally wrong message to send.  You failed to teach the
>> reader that there is no need to do anything special to tell the
>> command to follow per-line origin across renames.
>> 
>> So if anything, I would phrase it this way instead:
>> 
>>     --follow::
>>           This option is accepted but silently ignored.  "git blame"
>> 	  follows per-line origin across renames without any special
>> 	  options, and there is no reason to use this option.
>
> I think that is much better than Drew's text. But I really wonder if the
> right solution is to simply disallow --follow. It does not do anything,
> and it is not documented. There is no special reason to think that it
> would do anything, except by people who try it. So perhaps that is the
> right time to say "no, this is not a valid option".
>
> Like this (totally untested) patch:
>
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 0e102bf..412d6dd 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2365,6 +2365,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
>  			ctx.argv[0] = "--children";
>  			reverse = 1;
>  		}
> +		else if (!strcmp(ctx.argv[0], "--follow")) {
> +			error("unknown option `--follow`");
> +			usage_with_options(blame_opt_usage, options);
> +		}
>  		parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
>  	}
>  parse_done:

This patch would not hurt existing users very much; blame is an unlikely thing to run in scripts, and it is easy to remove the misguided --follow from them.

So I am in general OK with it, but if we are to go that route, we should make sure that the documentation makes it clear that blame follows whole-file renames without any special instruction before doing so. Otherwise, it again will send the same wrong message to people who try to use the "--follow" from their experience with "log", no?

Previous: Jeff KingNext: Jeff King
Message 8 of 15 in “git blame --follow”
  1. norbert.nemecSep 6, 2012
  2. Jeff KingSep 6, 2012
  3. norbert.nemecSep 6, 2012
  4. Jeff KingSep 6, 2012
  5. Documentation/git-blame.txt: --follow is a NO-OPDrew Northup, Sep 19, 2012
  6. Junio C HamanoSep 19, 2012
  7. Jeff KingSep 19, 2012
  8. Junio C HamanoSep 19, 2012
  9. Jeff KingSep 19, 2012
  10. Kevin BallardSep 19, 2012
  11. Jeff KingSep 19, 2012
  12. Kevin BallardSep 19, 2012
  13. Re* [PATCH] Documentation/git-blame.txt: --follow is a NO-OPJunio C Hamano, Sep 21, 2012
  14. Junio C HamanoSep 21, 2012
  15. Junio C HamanoSep 20, 2012

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.