Re: [PATCH v3 4/5] format-patch: teach --no-base
René Scharfe <l.s.r@web.de> writes:
Show 5 quoted lines
> Clearing the global variable base_auto feels unclean to me, as does the
> introduction of a callback for that purpose. Why not set base_commit
> after reading the config and before parsing command line options to
> reflect base_auto? That would achieve the intended precedence in a
> simpler way, something like this:
Show 23 quoted lines
>
> diff --git a/builtin/log.c b/builtin/log.c
> index a26f223ab4..af1b0d0209 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -1714,6 +1714,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
> rev.mime_boundary = default_attach;
> rev.no_inline = 1;
> }
> + if (base_auto)
> + base_commit = "auto";
>
> /*
> * Parse the arguments before setup_revisions(), or something
> @@ -1973,7 +1975,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
> }
>
> memset(&bases, 0, sizeof(bases));
> - if (base_commit || base_auto) {
> + if (base_commit) {
> struct commit *base = get_base_commit(base_commit, list, nr);
> reset_revision_walk();
> clear_object_flags(UNINTERESTING);