Sha256: f2cc260277e390c39519f3f013e0379f352de0decb650a64071f8801b60780b8

Contents?: true

Size: 480 Bytes

Versions: 2

Compression:

Stored size: 480 Bytes

Contents


module Atlassian
  module Stash
    module Git
      def get_current_branch
        %x(git symbolic-ref HEAD)[/refs\/heads\/(.*)/, 1]
      end

      def is_in_git_repository?
        system('git rev-parse')
      end

      def get_remote_url
        URI.extract(%x(git remote -v)).first
      end

      def ensure_within_git!
        if is_in_git_repository?
          yield
        else
          raise "fatal: Not a git repository"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atlassian-stash-0.1.1 lib/atlassian/stash/git.rb
atlassian-stash-0.1.0 lib/atlassian/stash/git.rb