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

Re: [PATCH 2/3] doc/git-log: describe --diff-merges=off

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2020, 00:06 UTC
Message-ID
<xmqq8sek917j.fsf@gitster.c.googlers.com>
In-Reply-To
<20200805220832.3800-3-sorganov@gmail.com>
Sergey Organov <sorganov@gmail.com> writes:
Show 14 quoted lines
> Signed-off-by: Sergey Organov <sorganov@gmail.com>
> ---
>  Documentation/git-log.txt | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
> index 9ccba65469d7..f3727c786453 100644
> --- a/Documentation/git-log.txt
> +++ b/Documentation/git-log.txt
> @@ -145,7 +145,6 @@ combined-diff option or with `--no-diff-merges`).
>  	rename or copy detection have been requested).
>  
>  -m::
> ---diff-merges::

Shouldn't this "--diff-merges" be removed from here? As [1/3] updated it like so:

-	} else if (!strcmp(arg, "-m") || !strcmp(arg, "--diff-merges")) {
+	} else if (!strcmp(arg, "-m")) {
 		revs->ignore_merges = 0;
+	} else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
+		if (!strcmp(optarg, "off")) {
+			revs->ignore_merges = 1;
+		} else {
+			die(_("unknown value for --diff-merges: %s"), optarg);
+		}
+		return argcount;

"git log --diff-merges" would get either an "option --diff-merges requires a value" error from diff.c::parse_long_opt(), or an "unknown value for --diff-merges: <opt>" error from the above code.

Other than that, I think 1&2/3 looks good, and we've covered the tests with 3/3 already, so we are in a reasonably good shape.

Thanks.
Show 14 quoted lines
>  	This flag makes the merge commits show the full diff like
>  	regular commits; for each merge parent, a separate log entry
>  	and diff is generated. An exception is that only diff against
> @@ -153,6 +152,11 @@ combined-diff option or with `--no-diff-merges`).
>  	in that case, the output represents the changes the merge
>  	brought _into_ the then-current branch.
>  
> +--diff-merges=off::
> +--no-diff-merges::
> +	Disable output of diffs for merge commits (default). Useful to
> +	override `-m`, `-c`, or `--cc`.
> +
>  :git-log: 1
>  include::diff-options.txt[]
Previous: Sergey OrganovNext: Junio C Hamano
Message 3 of 17 in “Change "--diff-merges" to require parameter”
  1. 0/3 Change "--diff-merges" to require parameterSergey Organov, Aug 5, 2020
  2. 2/3 doc/git-log: describe --diff-merges=offSergey Organov, Aug 5, 2020
  3. Junio C HamanoAug 12, 2020
  4. Junio C HamanoAug 12, 2020
  5. Sergey OrganovAug 12, 2020
  6. 1/3 revision: change "--diff-merges" option to require parameterSergey Organov, Aug 5, 2020
  7. 3/3 t/t4013: add test for --diff-merges=offSergey Organov, Aug 5, 2020
  8. Junio C HamanoAug 5, 2020
  9. Sergey OrganovAug 5, 2020
  10. Junio C HamanoAug 5, 2020
  11. Junio C HamanoAug 5, 2020
  12. Sergey OrganovAug 6, 2020
  13. Junio C HamanoAug 6, 2020
  14. Sergey OrganovAug 6, 2020
  15. Sergey OrganovAug 7, 2020
  16. Junio C HamanoAug 17, 2020
  17. Sergey OrganovAug 17, 2020

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.