[v2,2/3] log: add --no-use-mailmap option to complement --use-mailmap option
diff mbox series

Message ID 20190711172626.16480-3-ariadne@dereferenced.org
State New
Headers show
Series
  • use mailmap by default in git log
Related show

Commit Message

Ariadne Conill July 11, 2019, 5:26 p.m. UTC
When mailmap is enabled by default or by configuration, it may be
useful to override the default behaviour.  Previously, it was
possible to enable the mailmap feature when it was disabled by
default or in the configuration, but it was not possible to disable
the mailmap feature when it was enabled by default or by the
configuration.

The --no-use-mailmap option equalizes this by allowing the user to
explicitly enable or disable the mailmap feature according to their
requirements.

Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
---
 Documentation/git-log.txt | 5 +++++
 builtin/log.c             | 1 +
 2 files changed, 6 insertions(+)

Comments

Beat Bolli July 11, 2019, 6:24 p.m. UTC | #1
On 11.07.19 19:26, Ariadne Conill wrote:
> When mailmap is enabled by default or by configuration, it may be
> useful to override the default behaviour.  Previously, it was
> possible to enable the mailmap feature when it was disabled by
> default or in the configuration, but it was not possible to disable
> the mailmap feature when it was enabled by default or by the
> configuration.
> 
> The --no-use-mailmap option equalizes this by allowing the user to
> explicitly enable or disable the mailmap feature according to their
> requirements.
> 
> Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
> ---
>  Documentation/git-log.txt | 5 +++++
>  builtin/log.c             | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
> index b02e922dc3..50bc8f7da2 100644
> --- a/Documentation/git-log.txt
> +++ b/Documentation/git-log.txt
> @@ -54,6 +54,11 @@ OPTIONS
>  	addresses to canonical real names and email addresses. See
>  	linkgit:git-shortlog[1].
>  
> +--no-use-mailmap::
> +	Do not use the mailmap file to map author and commiter names
> +	and email addresses to canonical real names and email addresses.
> +	See linkgit:git-shortlog[1].
> +
>  --full-diff::
>  	Without this flag, `git log -p <path>...` shows commits that
>  	touch the specified paths, and diffs about the same specified
> diff --git a/builtin/log.c b/builtin/log.c
> index 3d2ce8fa3d..a9195bcb34 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
>  		OPT__QUIET(&quiet, N_("suppress diff output")),
>  		OPT_BOOL(0, "source", &source, N_("show source")),
>  		OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
> +		OPT_NEGBIT(0, "no-use-mailmap", &mailmap, N_("Do not use mail map file"), 1),

This works already. OPT_BOOL automatically handles the negation. You
just have to add "[no-]" to the documentation of --use-mailmap.

>  		OPT_STRING_LIST(0, "decorate-refs", &decorate_refs_include,
>  				N_("pattern"), N_("only decorate refs that match <pattern>")),
>  		OPT_STRING_LIST(0, "decorate-refs-exclude", &decorate_refs_exclude,
> 

Cheers,
Beat
Ariadne Conill July 11, 2019, 6:25 p.m. UTC | #2
Hello,

On Thu, Jul 11, 2019 at 1:24 PM Beat Bolli <dev+git@drbeat.li> wrote:
>
> On 11.07.19 19:26, Ariadne Conill wrote:
> > When mailmap is enabled by default or by configuration, it may be
> > useful to override the default behaviour.  Previously, it was
> > possible to enable the mailmap feature when it was disabled by
> > default or in the configuration, but it was not possible to disable
> > the mailmap feature when it was enabled by default or by the
> > configuration.
> >
> > The --no-use-mailmap option equalizes this by allowing the user to
> > explicitly enable or disable the mailmap feature according to their
> > requirements.
> >
> > Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
> > ---
> >  Documentation/git-log.txt | 5 +++++
> >  builtin/log.c             | 1 +
> >  2 files changed, 6 insertions(+)
> >
> > diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
> > index b02e922dc3..50bc8f7da2 100644
> > --- a/Documentation/git-log.txt
> > +++ b/Documentation/git-log.txt
> > @@ -54,6 +54,11 @@ OPTIONS
> >       addresses to canonical real names and email addresses. See
> >       linkgit:git-shortlog[1].
> >
> > +--no-use-mailmap::
> > +     Do not use the mailmap file to map author and commiter names
> > +     and email addresses to canonical real names and email addresses.
> > +     See linkgit:git-shortlog[1].
> > +
> >  --full-diff::
> >       Without this flag, `git log -p <path>...` shows commits that
> >       touch the specified paths, and diffs about the same specified
> > diff --git a/builtin/log.c b/builtin/log.c
> > index 3d2ce8fa3d..a9195bcb34 100644
> > --- a/builtin/log.c
> > +++ b/builtin/log.c
> > @@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
> >               OPT__QUIET(&quiet, N_("suppress diff output")),
> >               OPT_BOOL(0, "source", &source, N_("show source")),
> >               OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
> > +             OPT_NEGBIT(0, "no-use-mailmap", &mailmap, N_("Do not use mail map file"), 1),
>
> This works already. OPT_BOOL automatically handles the negation. You
> just have to add "[no-]" to the documentation of --use-mailmap.

Aha.  I was expecting it to behave like typical getopt_long() parsing,
where you have to handle this yourself.  No problem.  I'll clean that
up!  Thanks for the tip.

Ariadne
Beat Bolli July 11, 2019, 6:27 p.m. UTC | #3
On 11.07.19 20:25, Ariadne Conill wrote:
> Hello,
> 
> On Thu, Jul 11, 2019 at 1:24 PM Beat Bolli <dev+git@drbeat.li> wrote:
>>
>> On 11.07.19 19:26, Ariadne Conill wrote:
>>> When mailmap is enabled by default or by configuration, it may be
>>> useful to override the default behaviour.  Previously, it was
>>> possible to enable the mailmap feature when it was disabled by
>>> default or in the configuration, but it was not possible to disable
>>> the mailmap feature when it was enabled by default or by the
>>> configuration.
>>>
>>> The --no-use-mailmap option equalizes this by allowing the user to
>>> explicitly enable or disable the mailmap feature according to their
>>> requirements.
>>>
>>> Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
>>> ---
>>>  Documentation/git-log.txt | 5 +++++
>>>  builtin/log.c             | 1 +
>>>  2 files changed, 6 insertions(+)
>>>
>>> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
>>> index b02e922dc3..50bc8f7da2 100644
>>> --- a/Documentation/git-log.txt
>>> +++ b/Documentation/git-log.txt
>>> @@ -54,6 +54,11 @@ OPTIONS
>>>       addresses to canonical real names and email addresses. See
>>>       linkgit:git-shortlog[1].
>>>
>>> +--no-use-mailmap::
>>> +     Do not use the mailmap file to map author and commiter names
>>> +     and email addresses to canonical real names and email addresses.
>>> +     See linkgit:git-shortlog[1].
>>> +
>>>  --full-diff::
>>>       Without this flag, `git log -p <path>...` shows commits that
>>>       touch the specified paths, and diffs about the same specified
>>> diff --git a/builtin/log.c b/builtin/log.c
>>> index 3d2ce8fa3d..a9195bcb34 100644
>>> --- a/builtin/log.c
>>> +++ b/builtin/log.c
>>> @@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
>>>               OPT__QUIET(&quiet, N_("suppress diff output")),
>>>               OPT_BOOL(0, "source", &source, N_("show source")),
>>>               OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
>>> +             OPT_NEGBIT(0, "no-use-mailmap", &mailmap, N_("Do not use mail map file"), 1),
>>
>> This works already. OPT_BOOL automatically handles the negation. You
>> just have to add "[no-]" to the documentation of --use-mailmap.
> 
> Aha.  I was expecting it to behave like typical getopt_long() parsing,
> where you have to handle this yourself.  No problem.  I'll clean that
> up!  Thanks for the tip.
> 
> Ariadne

You're welcome!

Beat

Patch
diff mbox series

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index b02e922dc3..50bc8f7da2 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -54,6 +54,11 @@  OPTIONS
 	addresses to canonical real names and email addresses. See
 	linkgit:git-shortlog[1].
 
+--no-use-mailmap::
+	Do not use the mailmap file to map author and commiter names
+	and email addresses to canonical real names and email addresses.
+	See linkgit:git-shortlog[1].
+
 --full-diff::
 	Without this flag, `git log -p <path>...` shows commits that
 	touch the specified paths, and diffs about the same specified
diff --git a/builtin/log.c b/builtin/log.c
index 3d2ce8fa3d..a9195bcb34 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -167,6 +167,7 @@  static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
 		OPT__QUIET(&quiet, N_("suppress diff output")),
 		OPT_BOOL(0, "source", &source, N_("show source")),
 		OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
+		OPT_NEGBIT(0, "no-use-mailmap", &mailmap, N_("Do not use mail map file"), 1),
 		OPT_STRING_LIST(0, "decorate-refs", &decorate_refs_include,
 				N_("pattern"), N_("only decorate refs that match <pattern>")),
 		OPT_STRING_LIST(0, "decorate-refs-exclude", &decorate_refs_exclude,