Re: [PATCH] cg-diff fixed to work with BSD xargs
- From
Petr Baudis <pasky@suse.cz>
- Date
- Sep 21, 2005, 08:15 UTC
- Message-ID
- <20050921081547.GA24902@pasky.or.cz>
- In-Reply-To
- <pan.2005.09.21.07.33.14.533314@smurf.noris.de>
Dear diary, on Wed, Sep 21, 2005 at 09:33:15AM CEST, I got a letter where Matthias Urlichs <smurf@smurf.noris.de> told me that...
Show 24 quoted lines
> Hi, Martin Langhoff wrote: > > > Calls to cg-diff without filename parameters were dependent on GNU xargs > > traits. > > I don't know what drugs your shell was on when you tested this (assuming > that you did ;-) but this patch is wrong -- your test always succeeds, > due to the vagaries of test / [ ] semantics. > > > - cat $filter | xargs git-diff-cache -r -p $tree | colorize | pager > > + if [ -s $filter ]; then > > + cat $filter | xargs git-diff-cache -r -p $tree | colorize | pager > > + else > > + git-diff-cache -r -p $tree | colorize | pager > > + fi > > > $ foo="" > $ [ -s $foo ] > $ echo $? > 0 > $ [ -s "$foo" ] > $ echo $? > 1 > $
$filter is a file name. -s tests whether the file of that name exists and is non-empty.
-- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ VI has two modes: the one in which it beeps and the one in which it doesn't.