You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2009/07/07 02:48:01 UTC
svn commit: r791662 - /buildr/trunk/lib/buildr/core/build.rb
Author: assaf
Date: Tue Jul 7 00:48:01 2009
New Revision: 791662
URL: http://svn.apache.org/viewvc?rev=791662&view=rev
Log:
Good: check for nil. Bad: rescue all.
Modified:
buildr/trunk/lib/buildr/core/build.rb
Modified: buildr/trunk/lib/buildr/core/build.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/build.rb?rev=791662&r1=791661&r2=791662&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/build.rb (original)
+++ buildr/trunk/lib/buildr/core/build.rb Tue Jul 7 00:48:01 2009
@@ -108,8 +108,7 @@
module Git #:nodoc:
-
- module_function
+ module_function
# :call-seq:
# git(*args)
@@ -148,23 +147,19 @@
# Return the name of the remote repository whose branch the current local branch tracks,
# or nil if none.
def remote(branch = current_branch)
- remote = git('config', '--get', "branch.#{branch}.remote").strip
- remote if git('remote').include?(remote)
- rescue
- nil
+ remote = git('config', '--get', "branch.#{branch}.remote").to_s.strip
+ remote if !remote.empty? && git('remote').include?(remote)
end
# Return the name of the current branch
def current_branch
git('branch')[/^\* (.*)$/, 1]
end
-
end
module Svn #:nodoc:
-
- module_function
+ module_function
# :call-seq:
# svn(*args)