From: Petr Baudis Date: Wed, 21 Sep 2005 08:15:47 GMT Subject: Re: [PATCH] cg-diff fixed to work with BSD xargs Message-ID: <20050921081547.GA24902@pasky.or.cz> In-Reply-To: Dear diary, on Wed, Sep 21, 2005 at 09:33:15AM CEST, I got a letter where Matthias Urlichs told me that... > 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.