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

Re: [PATCH 0/1] blame: Skip missing ignore-revs file

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2021, 17:50 UTC
Message-ID
<xmqqim0fhlm1.fsf@gitster.g>
In-Reply-To
<xmqqtuk0h4ph.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> I think an easier way out is to introduce a new configuration
> variable blame.ignoreRevsFileIsOptional which takes a boolean value,
> and when it is set to true, silently ignore when the named file does
> not exist without any warning.  When the variable is set to false
> (or the variable does not exist), we can keep the current behaviour
> of noticing a misconfigured blame.ignoreRevsFile and error out.
>
> That way, the current users who rely on the typo detection feature
> can keep relying on it, and those who want to make it optional can
> do so without getting annoyed by a warning.

A bit more ambitious might want to consider another more generally applicable avenue, which would help the userbase a lot more, before continuing.

We start from the realization that this is not the only configuration variable that specifies a filename that could be missing. There may be other variables that name files to be used ("git config --help" would hopefully be the most comprehensive, but "git grep -e git_config_pathname \*.c" would give us quicker starting point to gauge how big an impact to the system we would be talking about).

What do the codepaths that use these variables do when they find that the named files are missing? Do some of them die, some others just warn, and yet some others silently ignore? Would such an inconsistency hurt our users?

Among the ones that die, are there ones that could reasonably continue as if the configuration variable weren't there and no file was specified (i.e. similar to what you want blame.ignoreRevsFile to do)? Among the ones that are silently ignored, are there ones that may benefit by having a typo-detection? Do all of them benefit if the behaviour upon missing files can be configurable by the end-user?

Depending on the answers to the above questions, it might be that it is not a desirable approach to add "blame.ignoreRevsFileIsOptional" configuration variable, as all the existing configuration variables that name files would want to add their own. We might be better off inventing a syntax for the value of blame.ignoreRevsFile (and other variables that name files) to mark if the file is optional (i.e. silently ignore if the named file does not exist) or required (i.e. diagnose as a configuration error). For example, we may borrow from the "magic" syntax for pathspecs that begin with ":(", with comma separated "magic" keywords and ends with ")" and specify optional pathname configuration like so:

    [blame] ignoreRevsFile = :(optional).gitignorerevs

and teach the config parser to pretend as if it saw nothing when it notices that the named file is missing. That approach would cover not just this single variable, but other variables that are parsed using git_config_pathname() may benefit the same way (of course, the callsites for git_config_pathmame() must be inspected and adjusted for this to happen).

Thanks.
Previous: Junio C HamanoNext: Noah Pendleton
Message 5 of 47 in “blame: Skip missing ignore-revs file”
  1. 0/1 blame: Skip missing ignore-revs fileNoah Pendleton, Aug 7, 2021
  2. Junio C HamanoAug 7, 2021
  3. Noah PendletonAug 7, 2021
  4. Junio C HamanoAug 8, 2021
  5. Junio C HamanoAug 8, 2021
  6. Noah PendletonAug 8, 2021
  7. Junio C HamanoAug 9, 2021
  8. 0/3 specifying a file that can optionally existJunio C Hamano, Oct 14, 2024
  9. 1/3 t7500: make each piece more independentJunio C Hamano, Oct 14, 2024
  10. 2/3 config: values of pathname type can be prefixed with :(optional)Junio C Hamano, Oct 14, 2024
  11. 3/3 parseopt: values of pathname type can be prefixed with :(optional)Junio C Hamano, Oct 14, 2024
  12. 0/3 specifying a file that can optionally existJunio C Hamano, May 1, 2025
  13. 1/3 t7500: make each piece more independentJunio C Hamano, May 1, 2025
  14. 2/3 config: values of pathname type can be prefixed with :(optional)Junio C Hamano, May 1, 2025
  15. Patrick SteinhardtMay 2, 2025
  16. Phillip WoodMay 2, 2025
  17. Junio C HamanoMay 2, 2025
  18. 3/3 parseopt: values of pathname type can be prefixed with :(optional)Junio C Hamano, May 1, 2025
  19. 0/3 Support :(optional) filepathsD. Ben Knoble, Sep 28, 2025
  20. 1/3 t7500: make each piece more independentD. Ben Knoble, Sep 28, 2025
  21. 2/3 config: values of pathname type can be prefixed with :(optional)D. Ben Knoble, Sep 28, 2025
  22. Phillip WoodSep 30, 2025
  23. Junio C HamanoOct 6, 2025
  24. Junio C HamanoOct 6, 2025
  25. Junio C HamanoOct 6, 2025
  26. Junio C HamanoOct 6, 2025
  27. Kristoffer HaugsbakkOct 7, 2025
  28. Junio C HamanoOct 7, 2025
  29. D. Ben KnobleNov 2, 2025
  30. 3/3 parseopt: values of pathname type can be prefixed with :(optional)D. Ben Knoble, Sep 28, 2025
  31. Phillip WoodSep 30, 2025
  32. D. Ben KnobleNov 2, 2025
  33. Eric SunshineNov 3, 2025
  34. D. Ben KnobleNov 4, 2025
  35. Junio C HamanoSep 28, 2025
  36. Ben KnobleSep 29, 2025
  37. t7500: fix tests with absolute path following ":(optional)" on WindowsJohannes Sixt, Oct 20, 2025
  38. Ben KnobleOct 20, 2025
  39. Johannes SixtOct 20, 2025
  40. Junio C HamanoOct 20, 2025
  41. D. Ben KnobleOct 20, 2025
  42. D. Ben KnobleOct 20, 2025
  43. Eric SunshineOct 20, 2025
  44. Junio C HamanoOct 20, 2025
  45. Johannes SixtOct 20, 2025
  46. Thranur AndulMar 4, 2022
  47. blame: add config `blame.ignoreRevsFileIsOptional`Noah Pendleton, Aug 8, 2021

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.