Re: [PATCH v3 3/3] send-email: do defaults -> config -> getopt in that order
- From
- Stephen Boyd <swboyd@chromium.org>
- Date
- May 16, 2019, 22:59 UTC
- Message-ID
- <5cddeb61.1c69fb81.47ed4.e648@mx.google.com>
- In-Reply-To
- <20190509114830.29647-4-avarab@gmail.com>
(Sorry for weird reply, I'm not subscribed and my MUA is not prepared for this)
Show 29 quoted lines
> Change the git-send-email command-line argument parsing and config
> reading code to parse those two in the right order. I.e. first we set
> our hardcoded defaults, then we read our config, and finally we read
> the command-line, with later sets overriding earlier sets.
>
> This fixes a bug introduced in e67a228cd8 ("send-email: automatically
> determine transfer-encoding", 2018-07-08). That change broke the broke
> the reading of sendmail.transferencoding because it wasn't careful to
> update our fragile code dealing with doing this in the previous
> "defaults -> getopt -> config" order..
>
> But as we can see from the history for this file doing it this way was
> never what we actually wanted, it just something we grew organically
> as of 5483c71d7a ("git-send-email: make options easier to configure.",
> 2007-06-27) and have been dealing with the fallout since, e.g. in
> 463b0ea22b ("send-email: Fix %config_path_settings handling",
> 2011-10-14).
>
> As can be seen in this change the only place where we actually want to
> do something clever is with the to/cc/bcc variables, where setting
> them on the command-line (or using --no-{to,cc,bcc}) should clear out
> values we grab from the config.
>
> All the rest are things where the command-line should simply override
> the config values, and by reading the config first the config code
> doesn't need all this "let's not set it was on the command-line"
> special-casing, as [1] shows we'd otherwise need to care about the
> difference between whether something was a default or present in
> config to fix the bug in e67a228cd8.This broke my workflow.
I specify --identity=<account> on the commandline and I want that to pick out my send-email config from my global .gitconfig file that corresponds to that identity. With this change, the config is parsed before the getopt part so --identity on the commandline is a nop and never looks into the config file to figure this out. So at least --identity is special in addition to --to,cc,bcc.