git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 3/4] color.ui config: don't die on unknown values

From
Junio C Hamano <gitster@pobox.com>
Date
May 30, 2018, 23:05 UTC
Message-ID
<xmqqin74d9rh.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180530210641.19771-4-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Before this change git will die on any unknown color.ui values:
>
>     $ git -c color.ui=doesnotexist show
>     fatal: bad numeric config value 'doesnotexist' for 'color.ui': invalid unit

I do not think "unit" is correct, so there may be some room for improvement. For _this_ particular case, I agree that it is not the end of the world if we did not color the output (because we do not know what the 'doesnotyetexist' token from the future is trying to tell us), but as a general principle, we should diagnose and die, if a misconfiguration is easy to correct, than blindly go ahead and do random things that the end-user did not expect by giving something we do not (but they thought they do) understand.

If we really want to introduce "here is a setting you may not understand, in which case you may safely ignore", the right way to do so is to follow the model the index extension took, where from the syntax of the unknown thing an old/existing code can tell if it is optional. Forcing all codepaths to forever ignore what they do not understand and what they happen to think is a safe fallback is simply being irresponsible---the existing code does not understand the new setting so they do not even know if their "current behaviour" as a fallback is a safe and sensible one from the point of view of the person who asked for the feature from the future.

Previous: Stefan BellerNext: Ævar Arnfjörð Bjarmason
Message 6 of 18 in “color.ui docs & add color.ui=isatty”
  1. 0/4 color.ui docs & add color.ui=isattyÆvar Arnfjörð Bjarmason, May 30, 2018
  2. 2/4 config doc: clarify "to a terminal" in color.uiÆvar Arnfjörð Bjarmason, May 30, 2018
  3. Jeff KingMay 31, 2018
  4. 3/4 color.ui config: don't die on unknown valuesÆvar Arnfjörð Bjarmason, May 30, 2018
  5. Stefan BellerMay 30, 2018
  6. Junio C HamanoMay 30, 2018
  7. Ævar Arnfjörð BjarmasonMay 31, 2018
  8. Jeff KingJun 1, 2018
  9. 1/4 config doc: move color.ui documentation to one placeÆvar Arnfjörð Bjarmason, May 30, 2018
  10. Jeff KingMay 31, 2018
  11. Ævar Arnfjörð BjarmasonMay 31, 2018
  12. Jeff KingJun 1, 2018
  13. 4/4 color.ui config: add "isatty" settingÆvar Arnfjörð Bjarmason, May 30, 2018
  14. Junio C HamanoMay 30, 2018
  15. Ævar Arnfjörð BjarmasonMay 31, 2018
  16. Jeff KingMay 31, 2018
  17. Ævar Arnfjörð BjarmasonMay 31, 2018
  18. Jeff KingJun 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.