Re: [PATCH] Fix t7004 which fails with retarded sed
- From
Mike Hommey <mh@glandium.org>
- Date
- Nov 16, 2007, 19:15 UTC
- Message-ID
- <20071116191533.GA7624@glandium.org>
- In-Reply-To
- <6E925AF7-FCCB-4793-936F-7BC513272E75@lrde.epita.fr>
On Fri, Nov 16, 2007 at 06:58:21PM +0100, Benoit Sigoure wrote:
Show 33 quoted lines
> On Nov 16, 2007, at 6:26 PM, Mike Hommey wrote: > >> Brown paper bag fix to avoid test failure with retarded sed. The test >> by itself didn't catch what it was supposed to, anyways. >> >> So now, we test whether the editor gets at least an empty line, some >> commented lines, and doesn't get anything else. >> >> Signed-off-by: Mike Hommey <mh@glandium.org> >> --- >> t/t7004-tag.sh | 4 +++- >> 1 files changed, 3 insertions(+), 1 deletions(-) >> >> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh >> index 096fe33..3813f23 100755 >> --- a/t/t7004-tag.sh >> +++ b/t/t7004-tag.sh >> @@ -1007,7 +1007,9 @@ test_expect_failure \ >> test_expect_success \ >> 'message in editor has initial comment' ' >> GIT_EDITOR=cat git tag -a initial-comment > actual || true && >> - test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0 >> + grep -e "^$" actual > /dev/null 2>&1 && >> + grep -e "^#" actual > /dev/null 2>&1 && >> + ! grep -e "^[^#]" actual > /dev/null 2>&1 >> ' >> >> get_tag_header reuse $commit commit $time >expect > > If your system has a retarded `sed', it will most likely also have a > brain-dead `/bin/sh' which doesn't handle `! command'. So I suggest you > rewrite the last line as: > grep -ve "^[^#]" actual > /dev/null 2>&1
A whole lot of the test suite uses `! command', which is why i chose to use it.
Mike