diff mbox series

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

Message ID 20200805220832.3800-3-sorganov@gmail.com (mailing list archive)
State New, archived
Headers show
Series Change "--diff-merges" to require parameter | expand

Commit Message

Sergey Organov Aug. 5, 2020, 10:08 p.m. UTC
Signed-off-by: Sergey Organov <sorganov@gmail.com>
---
 Documentation/git-log.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Junio C Hamano Aug. 12, 2020, 12:06 a.m. UTC | #1
Sergey Organov <sorganov@gmail.com> writes:

> 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.


>  	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[]
Junio C Hamano Aug. 12, 2020, 12:48 a.m. UTC | #2
Junio C Hamano <gitster@pobox.com> writes:

> Sergey Organov <sorganov@gmail.com> writes:
>
>> 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?

Sorry, my eyes.  Yes, you are removing it from here.

All is well, then.
Sergey Organov Aug. 12, 2020, 8:08 a.m. UTC | #3
Junio C Hamano <gitster@pobox.com> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> Sergey Organov <sorganov@gmail.com> writes:
>>
>>> 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?
>
> Sorry, my eyes.  Yes, you are removing it from here.

Don't mention it, -- these "---" caught me as well when I first looked
at the diff!

Thanks,
-- Sergey
diff mbox series

Patch

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::
 	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[]