Please rate my scripts.
Hans Fugal
hans at fugal.net
Mon Apr 14 10:49:51 MDT 2008
Hans Fugal wrote:
> > ARGC = ARGV.length
> > if (ARGC == 0) or ((ARGC == 1) and not exists?(ARGV[0]))
> > treeish = ARGV[0] || 'master'
>
> I might rewrite that as
>
> first = ARGV[0]
> if first.nil? or not File.exist?(first)
> treeish = first || 'master'
And add a comment - figuring out the intent of the if statement sprained
something.
> files = `git diff --name-only '#{treeish}'`.split('\n')
Pardon, that needs to be "\n".
--
Hans Fugal ; http://hans.fugal.net
There's nothing remarkable about it. All one has to do is hit the
right keys at the right time and the instrument plays itself.
-- Johann Sebastian Bach
More information about the PLUG
mailing list