Re: [PATCH v5] diff: add config option relative
To
Junio C Hamano
Cc
Laurent Arnoud
phillip.wood@dunelm.org.uk
brian m. carlson
git@vger.kernel.org
From
Đoàn Trần Công Danh
See Also
Prev Ref 1 Ref 2 Ref 3 Ref 4 Ref 5
Date
2020-05-18 19:12:05 UTC
On 2020-05-18 09:57:09-0700, Junio C Hamano <gitster@pobox.com> wrote:
> Hmph, what do you exactly mean by "broken patch"?
> 
> I actually do not mind people who set "diff.relative" to do
> 
>     $ git config diff.relative true
>     $ cd t && git format-patch -1 --stdout
> 
> to get an incomplete patch that covers only the t/ subdirectory, as
> long as they can ask Git to optionally get the full view with
> 
>     $ cd t && git format-patch -1 --stdout --no-relative

Well, git-format-patch has never understood --relative,
which I think is a sane behaviour,
hence git-format-patch will never understand --no-relative after this
patch.

Oh no, to my surprise, git-format-patch does accept --[no-]relative, now.

We don't document --relative for git-format-patch, the --relative
documentation is placed under the guard, for that matter:

Documentation/diff-options.txt 


ifndef::git-format-patch[]
-R::
        Swap two inputs; that is, show differences from index or
        on-disk file to tree contents.

--relative[=<path>]::
        When run from a subdirectory of the project, it can be
        told to exclude changes outside the directory and show
        pathnames relative to it with this option.  When you are
        not in a subdirectory (e.g. in a bare repository), you
        can name which subdirectory to make the output relative
        to by giving a <path> as an argument.
endif::git-format-patch[]

Maybe time to fix the documentation.

-- 
Danh