lib/origen/revision_control/git.rb in origen-0.5.6 vs lib/origen/revision_control/git.rb in origen-0.5.7
- old
+ new
@@ -1,7 +1,17 @@
module Origen
module RevisionControl
class Git < Base
+ # Returns the origin for the PWD
+ def self.origin
+ git('remote --verbose', verbose: false).each do |remote|
+ if remote =~ /^origin\s+([^\s]+)/
+ return Regexp.last_match(1)
+ end
+ end
+ nil
+ end
+
def build(options = {})
if Dir["#{local}/*"].empty? || options[:force]
FileUtils.rm_rf(local.to_s)
# Not using the regular 'git' method here since the local dir doesn't exist to CD into
system "git clone #{remote} #{local}"