On Sat, Apr 19, 2025 at 5:54 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > "jade via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > > It's currently a problem to put blame.ignoreRevsFile in a global > > gitconfig, for example, to use the GitHub (and other) supported filename > > of .git-blame-ignore-revs by default if present in a repo, since the > > current implementation exits the process if it fails to open the file. > > An alternative design that goes along the following lines may be > more palatable: > > - The way to spell for the users to specify a path that is > optional, either as the value of a command line option or a > configuration variable, is to prefix it with ":(optional)". E.g. > > [blame] > ignoreRevsFile = ":(optional).git-blame-ignore" > > $ git blame --ignore-revs-file=":(optional).git-blame-ignore" > > - For command line options, all commands that use parse-options API > would automatically benefit by updating parse-options.c and tweak > its handling of OPTION_FILENAME; when the specified string begins > with ":(optional)", you strip the prefix and see if the remainder > or the string names an existing file. If it does, you use the > filename as the value of that command line option; otherwise you > pretend that the option didn't even exist on the command line. For what it's worth, an initial implementation of ":(optional)" exists[*]. It was eventually dropped from Junio's "seen" branch merely because it never received any reviews, not due to any particular problem with it. [*]: https://lore.kernel.org/git/20241014204427.1712182-1-gitster@xxxxxxxxx/