Re: [PATCH v5] diff: add config option relative
To
Đoàn Trần Công Danh
Cc
Laurent Arnoud
phillip.wood@dunelm.org.uk
brian m. carlson
git@vger.kernel.org
From
Junio C Hamano
See Also
Prev Ref 1 Ref 2 Ref 3 Ref 4 Ref 5 Ref 6
Date
2020-05-19 18:00:54 UTC
Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:

> Sane people wouldn't want to read that document when we don't have the
> config for diff.relative
>
> But, now, we have. Let's document --no-relative, specifically for
> git-format-patch(1).
>
> Perhaps something like this (maybe just fixing up to Laurent's)

I love it when a contributor pushes back with a well thought out
counter-argument.  Yes, I think the reasoning along the line makes
sense.

If a project binds another project with -Xsubtree=<path>, a change
to that part would be a good candidate to use "format-patch" with
the "--relative=<path>".  We didn't consider it a use case that is
interesting enough, but it may be, which gives another reason why
documenting "--[no-]relative[=<path>]" for the command may not be a
bad thing, not just for the purpose of defeating "diff.relative".

For that reason, it may even make sense to use the same text for
--no-relative and --relative[=<path>] we use for other commands in
the diff family, i.e. leaving only -R inside the ifndef block.

Thanks.

> -----------------8<--------------
> From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
>  <congdanhqx@gmail.com>
> Date: Tue, 19 May 2020 07:24:48 +0700
> Subject: [PATCH] Documentation: document --no-relative for format-patch
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> git-format-patch(1) accepts --relative for a long time, but the
> generated patch couldn't be applied without accompanying information.
>
> Hence, we've never document --relative for git-format-patch(1).
>
> Now, we've introduced `diff.relative` config, let's tell Git's users
> that they have an option to override it.
>
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> ---
>  Documentation/diff-options.txt | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
> index 167b451b89..0f5c108324 100644
> --- a/Documentation/diff-options.txt
> +++ b/Documentation/diff-options.txt
> @@ -654,6 +654,11 @@ ifndef::git-format-patch[]
>  	`--no-relative` can be used to countermand both `diff.relative` config
>  	option and previous `--relative`.
>  endif::git-format-patch[]
> +ifdef::git-format-patch[]
> +--no-relative::
> +	Countermand `diff.relative` config. Show all changes in the repository
> +	with pathname relative to top-level directory of the repository.
> +endif::git-format-patch[]
>  
>  -a::
>  --text::