Sha256: 396e3f3bf585cb119413b54c6a9b01437d49fa762684bc0ae28206290f0b6b5c

Contents?: true

Size: 821 Bytes

Versions: 5

Compression:

Stored size: 821 Bytes

Contents

module Git
  module Multi

    module_function

    def local_option(path, name, default = nil)
      value = `git -C #{path} config --local --get #{name}`.chomp.freeze
      value.empty? && default ? default : value
    end

    def full_names_for(superproject)
      list = `git config --get-all superproject.#{superproject}.repo`
      list.split($RS).map(&:strip).map(&:freeze)
    end

    def global_option(name, default = nil)
      value = `git config --global --get #{name}`.chomp.freeze
      value.empty? && default ? default : value
    end

    def global_list(name, default = nil)
      global_option(name, default).split(',').map(&:strip).map(&:freeze)
    end

    def env_var(name, default = nil)
      value = ENV[name]
      (value.nil? || value.empty?) && default ? default : value
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-multi-4.0.1 lib/git/multi/config.rb
git-multi-4.0.0 lib/git/multi/config.rb
git-multi-3.0.3 lib/git/multi/config.rb
git-multi-3.0.2 lib/git/multi/config.rb
git-multi-3.0.0 lib/git/multi/config.rb