git 1.17.2 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cebf2eab3cc2c8cc605b1e3b9aeafa2f2c82ef0a50be725fc211fdb55a7980c0
4
- data.tar.gz: 9df1a5d2f067aa183a65cea1cd21e7260b72213f92c50b60bda26f261b2e7d23
3
+ metadata.gz: b3c801f928c5b75999c02cecd054c0007a8e2f0460c27bc2b983741824d7b194
4
+ data.tar.gz: 861bf03f14ed76dcf43acefcc8fe33787e202a9af52e7789d6d1660f84b4fc51
5
5
  SHA512:
6
- metadata.gz: 57019fb39b7476d7ee5d97fd1c21f1bffa3b1fbd59413e5bb602794c106f38c2bc528c1a86b98b89bc835976671ea836a1bdf911aa9a281b81b97d221c12b80d
7
- data.tar.gz: d2f2927fbdf6b13b66d931183d6effb5fbb651e10c77a393e6b035ccc88e5b6ffd60dbed859fa6c400cd4551df253be89074e20aaa0f40379b609e79bd3553fa
6
+ metadata.gz: 4a4bf752eb3332572f968ea23a5cc4a4e4547279f60ce2341d6d6d815f5d9f4cbd17237b266c9cd2850c77c2c9a189ff98034af5385333632f557e765cb7b64a
7
+ data.tar.gz: e678b9da94ccd8295347688d3dd3e400764da4af3f850ceaa0038e4ddb34804fd2cc3942119a9f66968b4c014fb07a040352c7b6494556298cebd826bc765fd8
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## v1.18.0 (2023-03-19)
9
+
10
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.17.2..v1.18.0)
11
+
12
+ Changes since v1.17.2:
13
+
14
+ * 3c70 Add support for `--update-head-ok` to `fetch` (#660)
15
+ * b53d Do not generate yard documentation when building in TruffleRuby (#659)
16
+ * 5af1 Correctly report command output when there is an error (#658)
17
+ * b27a Add test to ensure that `Git.open` works to open a submodule (#655)
18
+ * 5b0e Update Git.clone to set multiple config variables (#653)
19
+
8
20
  ## v1.17.2 (2023-03-07)
9
21
 
10
22
  [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.17.1..v1.17.2)
data/README.md CHANGED
@@ -188,6 +188,18 @@ end
188
188
  g.config('user.name') # returns 'Scott Chacon'
189
189
  g.config # returns whole config hash
190
190
 
191
+ # Configuration can be set when cloning using the :config option.
192
+ # This option can be an single configuration String or an Array
193
+ # if multiple config items need to be set.
194
+ #
195
+ g = Git.clone(
196
+ git_uri, destination_path,
197
+ :config => [
198
+ 'core.sshCommand=ssh -i /home/user/.ssh/id_rsa',
199
+ 'submodule.recurse=true'
200
+ ]
201
+ )
202
+
191
203
  g.tags # returns array of Git::Tag objects
192
204
 
193
205
  g.show()
@@ -299,6 +311,7 @@ g.fetch
299
311
  g.fetch(g.remotes.first)
300
312
  g.fetch('origin', {:ref => 'some/ref/head'} )
301
313
  g.fetch(all: true, force: true, depth: 2)
314
+ g.fetch('origin', {:'update-head-ok' => true})
302
315
 
303
316
  g.pull
304
317
  g.pull(Git::Repo, Git::Branch) # fetch and a merge
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ task :test do
18
18
  end
19
19
  default_tasks << :test
20
20
 
21
- unless RUBY_PLATFORM == 'java'
21
+ unless RUBY_PLATFORM == 'java' || RUBY_ENGINE == 'truffleruby'
22
22
  #
23
23
  # YARD documentation for this project can NOT be built with JRuby.
24
24
  # This project uses the redcarpet gem which can not be installed on JRuby.
@@ -14,18 +14,20 @@ module Git
14
14
  class FailedError < Git::GitExecuteError
15
15
  # Create a FailedError object
16
16
  #
17
+ # Since this gem redirects stderr to stdout, the stdout of the process is used.
18
+ #
17
19
  # @example
18
20
  # `exit 1` # set $? appropriately for this example
19
- # result = Git::CommandLineResult.new(%w[git status], $?, '', "failed")
21
+ # result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
20
22
  # error = Git::FailedError.new(result)
21
23
  # error.message #=>
22
- # "[\"git\", \"status\"]\nstatus: pid 89784 exit 1\nstderr: \"failed\""
24
+ # "[\"git\", \"status\"]\nstatus: pid 89784 exit 1\noutput: \"stdout\""
23
25
  #
24
26
  # @param result [Git::CommandLineResult] the result of the git command including
25
27
  # the git command, status, stdout, and stderr
26
28
  #
27
29
  def initialize(result)
28
- super("#{result.git_cmd}\nstatus: #{result.status}\nstderr: #{result.stderr.inspect}")
30
+ super("#{result.git_cmd}\nstatus: #{result.status}\noutput: #{result.stdout.inspect}")
29
31
  @result = result
30
32
  end
31
33
 
@@ -35,14 +37,14 @@ module Git
35
37
  #
36
38
  # @example
37
39
  # `exit 1` # set $? appropriately for this example
38
- # result = Git::CommandLineResult.new(%w[git status], $?, '', "failed")
40
+ # result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
39
41
  # error = Git::FailedError.new(result)
40
42
  # error.result #=>
41
43
  # #<Git::CommandLineResult:0x00000001046bd488
42
44
  # @git_cmd=["git", "status"],
43
45
  # @status=#<Process::Status: pid 89784 exit 1>,
44
- # @stderr="failed",
45
- # @stdout="">
46
+ # @stderr="stderr",
47
+ # @stdout="stdout">
46
48
  #
47
49
  # @return [Git::CommandLineResult]
48
50
  #
data/lib/git/lib.rb CHANGED
@@ -101,7 +101,7 @@ module Git
101
101
  arr_opts << '--bare' if opts[:bare]
102
102
  arr_opts << '--branch' << opts[:branch] if opts[:branch]
103
103
  arr_opts << '--depth' << opts[:depth].to_i if opts[:depth] && opts[:depth].to_i > 0
104
- arr_opts << '--config' << opts[:config] if opts[:config]
104
+ Array(opts[:config]).each { |c| arr_opts << '--config' << c }
105
105
  arr_opts << '--origin' << opts[:remote] || opts[:origin] if opts[:remote] || opts[:origin]
106
106
  arr_opts << '--recursive' if opts[:recursive]
107
107
  arr_opts << '--mirror' if opts[:mirror]
@@ -951,6 +951,7 @@ module Git
951
951
  arr_opts << '--prune' if opts[:p] || opts[:prune]
952
952
  arr_opts << '--prune-tags' if opts[:P] || opts[:'prune-tags']
953
953
  arr_opts << '--force' if opts[:f] || opts[:force]
954
+ arr_opts << '--update-head-ok' if opts[:u] || opts[:'update-head-ok']
954
955
  arr_opts << '--unshallow' if opts[:unshallow]
955
956
  arr_opts << '--depth' << opts[:depth] if opts[:depth]
956
957
  arr_opts << '--' if remote || opts[:ref]
data/lib/git/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  # The current gem version
3
3
  # @return [String] the current gem version.
4
- VERSION='1.17.2'
4
+ VERSION='1.18.0'
5
5
  end
data/lib/git.rb CHANGED
@@ -133,6 +133,9 @@ module Git
133
133
  # @option options [String] :branch The name of a branch or tag to checkout
134
134
  # instead of the default branch.
135
135
  #
136
+ # @option options [Array, String] :config A list of configuration options to
137
+ # set on the newly created repository.
138
+ #
136
139
  # @option options [Integer] :depth Create a shallow clone with a history
137
140
  # truncated to the specified number of commits.
138
141
  #
@@ -166,6 +169,18 @@ module Git
166
169
  # @example Create a bare repository in the directory `ruby-git.git`
167
170
  # git = Git.clone('https://github.com/ruby-git/ruby-git.git', bare: true)
168
171
  #
172
+ # @example Clone a repository and set a single config option
173
+ # git = Git.clone(
174
+ # 'https://github.com/ruby-git/ruby-git.git',
175
+ # config: 'submodule.recurse=true'
176
+ # )
177
+ #
178
+ # @example Clone a repository and set multiple config options
179
+ # git = Git.clone(
180
+ # 'https://github.com/ruby-git/ruby-git.git',
181
+ # config: ['user.name=John Doe', 'user.email=john@doe.com']
182
+ # )
183
+ #
169
184
  # @return [Git::Base] an object that can execute git commands in the context
170
185
  # of the cloned local working copy or cloned repository.
171
186
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.2
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon and others
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-07 00:00:00.000000000 Z
11
+ date: 2023-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable