Re: [PATCH v5] diff: add config option relative
- From
Shourya Shukla <shouryashukla.oo@gmail.com>
- Date
- May 18, 2020, 11:46 UTC
- Message-ID
- <20200518114630.GA30622@konoha>
- In-Reply-To
- <20200518094021.GA2069@spk-laptop>
Hello Laurent,
I have not worked in this part of Git before, please pardon my ignorance. I went through the conversations held in this thread Here are my inferences:
> The `diff.relative` boolean option set to `true` show only changes on > the current directory and show relative pathnames to the current > directory.
> Teach --no-relative to override earlier --relative
I think the message can be written better, maybe something like:
The `diff.relative` boolean option set to `true` shows only changes
in the current directory/value specified by the `path` argument of
the `relative` option and shows pathnames relative to the
aforementioned directory.Teach `--no-relative` to override the earlier `--relative`
Show 9 quoted lines
> --- a/Documentation/config/diff.txt > +++ b/Documentation/config/diff.txt > @@ -105,6 +105,10 @@ diff.mnemonicPrefix:: > diff.noprefix:: > If set, 'git diff' does not show any source or destination prefix. > > +diff.relative:: > + If set to 'true', 'git diff' does not show changes outside of the directory > + and show pathnames relative to the current directory.
In the second last line, it would be better to write is as:
... does not show changes outside of the current directory/the path
provided as the argument in `relative`?Even my version of the above line seems very crude and innaccurate, but I think that we should take into account the `path` passed down to us by the `--relative[=<path>]` option.
Moving on, what I wondered was that maybe making it a `true/false` option would be better? Something like:
git diff --relative=false //override the diff.relative setting
git diff --relative=true <path> //works like the usual `relative`And by the usual, I mean :
git diff --relative[=<path>]What do you think? I think it would be better than adding a new option.
Also, if I am not mistaken:
Show 7 quoted lines
> @@ -5195,8 +5202,7 @@ static int diff_opt_relative(const struct option *opt,
> {
> struct diff_options *options = opt->value;
>
> - BUG_ON_OPT_NEG(unset);
> - options->flags.relative_name = 1;
> + options->flags.relative_name = !unset;This is the overriding part right?
BTW you mention the `no-relative` setting which will override the `relative` option. I am not able to see where exactly is the occurence of the `no-relative` option in the code? What I mean is that I am not able to observe where exactly does the C code identify a `no-relative` option from the command line input? Did I miss something out here?
All nits aside, it looks like a very good concept to me. Nice work! :)
Regards, Shourya Shukla