From: Eric Sunshine Date: Fri, 26 Jan 2018 22:07:07 GMT Subject: Re: [PATCH 09/10] t: make sure that 'test_i18ngrep' got enough parameters Message-ID: In-Reply-To: <20180126123708.21722-10-szeder.dev@gmail.com> On Fri, Jan 26, 2018 at 7:37 AM, SZEDER Gábor wrote: > Two of the previous patches in this series fixed two bogus > 'test_i18ngrep' invocations that had neither a filename parameter not s/not/nor/ > anything piped into their standard input, yet both managed to remain > unnoticed for years. A third similarly bogus invocation is currently > lurking in 'pu' for a couple of weeks now. > > Try to catch similar mistakes in the future by ensuring that > 'test_i18ngrep' has at least two parameters, not including an optional > '!' to negate the pattern. Perform these checks after we made sure > that there is no data on the 'test_i18ngrep's standard input, so if > the filename parameter is missing because someone is piping a git > command's output into this function, then they would get the more > relevant error message. > > Note that this is not quite perfect, as it doesn't account for any > 'grep --options' given as parameters. However, doing so would be far > too complicated, considering that patters can start with dashes as > well, and in the majority of the cases we don't use any such options > anyway. > > Signed-off-by: SZEDER Gábor