From: Jonathan Nieder Date: Tue, 04 Aug 2020 17:02:20 GMT Subject: Re: [PATCH v2 01/18] maintenance: create basic maintenance runner Message-ID: <20200804170220.GB227292@google.com> In-Reply-To: <2b6da345-d004-1d83-78cd-3f1ceaf278d9@gmail.com> Derrick Stolee wrote: > Here is my attempt so far: [...] > test_subcommand_called "gc" run-no-auto.txt && > test_subcommand_not_called "gc --auto" run-auto.txt && > test_subcommand_called "gc --quiet" run-quiet.txt I like it. Some tweaks: - can simplify by using 'printf' instead of sed - passing the trace in stdin - following the convention that helpers like test_i18ngrep use of accepting ! as a parameter to negate the exit code That would make (untested) # Check that the given command was invoked as part of the # trace2-format trace on stdin. # # test_subcommand_called [!] ... < # # For example, to look for an invocation of "git upload-pack # /path/to/repo" # # GIT_TRACE2_EVENT=event.log git fetch ... && # test_subcommand_called git upload-pack "$PATH"