git 1.12.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '03386fbc4d48647754608adba467800440ec80e5e8aecddac930a3e2565827bd'
4
- data.tar.gz: 180866b01d05c40d495638ee8ddf2a1d8ca2e534250575c09c20728a2473855e
3
+ metadata.gz: 8d000b5ac2ceebebeb6c84eae6aa1c6f4b3d58dd444f15c70390baadf7bb3c8e
4
+ data.tar.gz: f45ef489fb3aa2d3cff1a45cb127bb27fe380693af5e322220322fd8aa6dfd33
5
5
  SHA512:
6
- metadata.gz: b5115fff1ce7fbbc3a0fb8d22b8f27b6c3acb00e27613e3e8d0a4d760c2b40a0355a3c2e57e3e8d14e91545f985eea51caca44eab4b04b112f00393e64f48216
7
- data.tar.gz: 4494ee6206a07e17b2c1bb983c7519689364c1ec15bfa811a3ab4cf380aba9a29c783adfff82917c0379a7911b2a5a51d0661bf928f69d9502a271d8d11a846e
6
+ metadata.gz: 6128142518501bce8bd4e5f40e178ac063359916daf544005bdc6187160619b74c6236a7f56b29438f3b5ebb547a5759b59b3140ee260ebd179bc8a4124d1a15
7
+ data.tar.gz: 56e9d4940992d8feab68502815563d6d16967c1d659748271bdd27e0e1a382f81ce4be4dd7682645b562f8b616be791f79437fdaaa072778aca724c91e40b4d1
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: [2.3, 2.7, 3.0]
16
+ ruby: [2.7, 3.0, 3.1, 3.2]
17
17
  operating-system: [ubuntu-latest]
18
18
  include:
19
19
  - ruby: head
@@ -34,7 +34,7 @@ jobs:
34
34
 
35
35
  steps:
36
36
  - name: Checkout Code
37
- uses: actions/checkout@v2
37
+ uses: actions/checkout@v3
38
38
 
39
39
  - name: Setup Ruby
40
40
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## v1.13.1 (2023-01-12)
9
+
10
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.13.0...v1.13.1)
11
+
12
+ * 667b830 Update the GitHub Action step "actions/checkout" from v2 to v3 (#608)
13
+ * 23a0ac4 Fix version parsing (#605)
14
+ * 429f0bb Update release instructions (#606)
15
+ * 68d76b8 Drop ruby 2.3 build and add 3.1 and 3.2 builds (#607)
16
+
17
+ ## v1.13.0 (2022-12-10)
18
+
19
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.12.0...v1.13.0)
20
+
21
+ * 8349224 Update list of maintainers (#598)
22
+ * 4fe8738 In ls-files do not unescape file paths with eval (#602)
23
+ * 74b8e11 Add start_point option for checkout command (#597)
24
+ * ff6dcf4 Do not assume the default branch is 'master' in tests
25
+ * 8279298 Fix exception when Git is autoloaded (#594)
26
+
8
27
  ## v1.12.0
9
28
 
10
29
  See https://github.com/ruby-git/ruby-git/releases/tag/v1.12.0
@@ -151,4 +170,3 @@ See https://github.com/ruby-git/ruby-git/releases/tag/v1.4.0
151
170
  ## 1.0.1
152
171
 
153
172
  * Initial version
154
-
data/MAINTAINERS.md CHANGED
@@ -7,7 +7,6 @@
7
7
 
8
8
  When making changes in this repository, one of the maintainers below must review and approve your pull request.
9
9
 
10
- ### Maintainers
11
-
10
+ * [James Couball](https://github.com/jcouball)
11
+ * [Frank Throckmorton](https://github.com/frankthrock)
12
12
  * [Per Lundberg](https://github.com/perlun)
13
- * [James Couball](https://github.com/jcouball)
data/README.md CHANGED
@@ -265,6 +265,7 @@ g.branch('existing_branch').checkout
265
265
  g.branch('master').contains?('existing_branch')
266
266
 
267
267
  g.checkout('new_branch')
268
+ g.checkout('new_branch', new_branch: true, start_point: 'master')
268
269
  g.checkout(g.branch('new_branch'))
269
270
 
270
271
  g.branch(name).merge(branch2)
data/RELEASING.md CHANGED
@@ -8,61 +8,63 @@
8
8
  Releasing a new version of the `git` gem requires these steps:
9
9
 
10
10
  - [How to release a new git.gem](#how-to-release-a-new-gitgem)
11
- - [Prepare the release](#prepare-the-release)
12
- - [Create a GitHub release](#create-a-github-release)
13
- - [Build and release the gem](#build-and-release-the-gem)
14
-
15
- These instructions use an example where the current release version is `1.5.0`
16
- and the new release version to be created is `1.6.0.pre1`.
17
-
18
- ## Prepare the release
19
-
20
- From a fork of ruby-git, create a PR containing changes to (1) bump the
21
- version number, (2) update the CHANGELOG.md, and (3) tag the release.
22
-
23
- - Bump the version number in lib/git/version.rb following [Semantic Versioning](https://semver.org)
24
- guidelines
25
- - Add a link in CHANGELOG.md to the release tag which will be created later
26
- in this guide
27
- - Create a new tag using [git-extras](https://github.com/tj/git-extras/blob/master/Commands.md#git-release)
28
- `git release` command
29
- - For example: `git release v1.6.0.pre1`
30
- - These should be the only changes in the PR
31
- - An example of these changes for `v1.6.0.pre1` can be found in [PR #435](https://github.com/ruby-git/ruby-git/pull/435)
32
- - Get the PR reviewed, approved and merged to master.
33
-
34
- ## Create a GitHub release
35
-
36
- On [the ruby-git releases page](https://github.com/ruby-git/ruby-git/releases),
37
- select `Draft a new release`
38
-
39
- - Select the tag corresponding to the version being released `v1.6.0.pre1`
40
- - The Target should be `master`
41
- - For the release description, use the output of [changelog-rs](https://github.com/perlun/changelog-rs)
42
- - A Docker image is provided in [Dockerfile.changelog-rs](https://github.com/ruby-git/ruby-git/blob/master/Dockerfile.changelog-rs)
43
- so you don't have to install changelog-rs or the Rust tool chain. To build the
44
- Docker image, run this command from this project's root directory:
45
- - `docker build --file Dockerfile.changelog-rs --tag changelog-rs .`
46
- - To run the changelog-rs command using this image, run the following command
47
- from this project's root directory (replace the tag names appropriate for the
48
- current release):
49
- - `docker run --rm --volume "$PWD:/worktree" changelog-rs v1.5.0 v1.6.0.pre1`
50
- - Copy the output, omitting the tag header `## v1.6.0.pre1` and paste into
51
- the release description
52
- - The release description can be edited later if needed
53
- - Select the appropriate value for `This is a pre-release`
54
- - Since `v1.6.0.pre1` is a pre-release, check `This is a pre-release`
55
-
56
- ## Build and release the gem
57
-
58
- Clone [ruby-git/ruby-git](https://github.com/ruby-git/ruby-git) directly (not a
59
- fork) and ensure your local working copy is on the master branch
60
-
61
- - Verify that you are not on a fork with the command `git remote -v`
62
- - Verify that the version number is correct by running `rake -T` and inspecting
63
- the output for the `release[remote]` task
64
-
65
- Build the git gem and push it to rubygems.org with the command `rake release`
66
-
67
- - Ensure that your `gem sources list` includes `https://rubygems.org` (in my
68
- case, I usually have my work’s internal gem repository listed)
11
+ - [Install Prerequisites](#install-prerequisites)
12
+ - [Prepare the Release](#prepare-the-release)
13
+ - [Review and Merge the Release](#review-and-merge-the-release)
14
+ - [Build and Release the Gem](#build-and-release-the-gem)
15
+
16
+ These instructions use an example where:
17
+
18
+ - The default branch is `master`
19
+ - The current release version is `1.5.0`
20
+ - You want to create a new *minor* release, `1.6.0`
21
+
22
+ ## Install Prerequisites
23
+
24
+ The following tools need to be installed in order to create the release:
25
+
26
+ - [git](https://git-scm.com) is used to interact with the local and remote repositories
27
+ - [gh](https://cli.github.com) is used to create the release and PR in GitHub
28
+ - [Docker](https://www.docker.com) is used to run the script to create the release notes
29
+
30
+ On a Mac, these tools can be installed using [brew](https://brew.sh):
31
+
32
+ ```shell
33
+ $ brew install git
34
+ ...
35
+ $ brew install gh
36
+ ...
37
+ $ brew install --cask docker
38
+ ...
39
+ $
40
+ ```
41
+
42
+ ## Prepare the Release
43
+
44
+ Bump the version, create release notes, tag the release and create a GitHub release and PR which can be used to review the release.
45
+
46
+ Steps:
47
+
48
+ - Check out the code with `git clone https://github.com/ruby-git/ruby-git ruby-git-v1.6.0 && cd ruby-git-v1.6.0`
49
+ - Install development dependencies using bundle `bundle install`
50
+ - Based upon the nature of the changes, decide on the type of release: `major`, `minor`, or `patch` (in this example we will use `minor`)
51
+ - Run the release script `bundle exec create-github-release minor`
52
+
53
+ ## Review and Merge the Release
54
+
55
+ Have the release PR approved and merge the changes into the `master` branch.
56
+
57
+ **IMPORTANT** DO NOT merge to the `master` branch using the GitHub UI. Instead use the instructions below.
58
+
59
+ Steps:
60
+
61
+ - Get the release PR reviewed and approved in GitHub
62
+ - Merge the changes with the command `git checkout master && git merge --ff-only v1.6.0 && git push`
63
+
64
+ ## Build and Release the Gem
65
+
66
+ Build the gem and publish it to [rubygems.org](https://rubygems.org/gems/git)
67
+
68
+ Steps:
69
+
70
+ - Build and release the gem using rake `bundle exec rake release`
data/git.gemspec CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency 'rchardet', '~> 1.8'
31
31
 
32
32
  s.add_development_dependency 'bump', '~> 0.10'
33
+ s.add_development_dependency 'create_github_release', '~> 0.2'
33
34
  s.add_development_dependency 'minitar', '~> 0.9'
34
35
  s.add_development_dependency 'rake', '~> 13.0'
35
36
  s.add_development_dependency 'test-unit', '~> 3.3'
data/lib/git/lib.rb CHANGED
@@ -486,7 +486,9 @@ module Git
486
486
  command_lines('ls-files', '--stage', location).each do |line|
487
487
  (info, file) = line.split("\t")
488
488
  (mode, sha, stage) = info.split
489
- file = eval(file) if file =~ /^\".*\"$/ # This takes care of quoted strings returned from git
489
+ if file.start_with?('"') && file.end_with?('"')
490
+ file = Git::EscapedPath.new(file[1..-2]).unescape
491
+ end
490
492
  hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage}
491
493
  end
492
494
  hsh
@@ -762,11 +764,21 @@ module Git
762
764
  command('branch', '-D', branch)
763
765
  end
764
766
 
767
+ # Runs checkout command to checkout or create branch
768
+ #
769
+ # accepts options:
770
+ # :new_branch
771
+ # :force
772
+ # :start_point
773
+ #
774
+ # @param [String] branch
775
+ # @param [Hash] opts
765
776
  def checkout(branch, opts = {})
766
777
  arr_opts = []
767
778
  arr_opts << '-b' if opts[:new_branch] || opts[:b]
768
779
  arr_opts << '--force' if opts[:force] || opts[:f]
769
780
  arr_opts << branch
781
+ arr_opts << opts[:start_point] if opts[:start_point] && arr_opts.include?('-b')
770
782
 
771
783
  command('checkout', arr_opts)
772
784
  end
@@ -1015,8 +1027,9 @@ module Git
1015
1027
  # returns the current version of git, as an Array of Fixnums.
1016
1028
  def current_command_version
1017
1029
  output = command('version')
1018
- version = output[/\d+\.\d+(\.\d+)+/]
1019
- version.split('.').collect {|i| i.to_i}
1030
+ version = output[/\d+(\.\d+)+/]
1031
+ version_parts = version.split('.').collect { |i| i.to_i }
1032
+ version_parts.fill(0, version_parts.length...3)
1020
1033
  end
1021
1034
 
1022
1035
  def required_command_version
@@ -1027,6 +1040,14 @@ module Git
1027
1040
  (self.current_command_version <=> self.required_command_version) >= 0
1028
1041
  end
1029
1042
 
1043
+ def self.warn_if_old_command(lib)
1044
+ return true if @version_checked
1045
+ @version_checked = true
1046
+ unless lib.meets_required_version?
1047
+ $stderr.puts "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade."
1048
+ end
1049
+ true
1050
+ end
1030
1051
 
1031
1052
  private
1032
1053
 
@@ -1083,6 +1104,8 @@ module Git
1083
1104
  end
1084
1105
 
1085
1106
  def command(cmd, *opts, &block)
1107
+ Git::Lib.warn_if_old_command(self)
1108
+
1086
1109
  command_opts = { chomp: true, redirect: '' }
1087
1110
  if opts.last.is_a?(Hash)
1088
1111
  command_opts.merge!(opts.pop)
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.12.0'
4
+ VERSION='1.13.1'
5
5
  end
data/lib/git.rb CHANGED
@@ -27,11 +27,6 @@ require 'git/working_directory'
27
27
  require 'git/worktree'
28
28
  require 'git/worktrees'
29
29
 
30
- lib = Git::Lib.new(nil, nil)
31
- unless lib.meets_required_version?
32
- $stderr.puts "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade."
33
- end
34
-
35
30
  # The Git module provides the basic functions to open a git
36
31
  # reference to work with. You can open a working directory,
37
32
  # open a bare repository, initialize a new repo or clone an
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.12.0
4
+ version: 1.13.1
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: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2023-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: create_github_release
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.2'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitar
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -217,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
231
  version: '0'
218
232
  requirements:
219
233
  - git 1.6.0.0, or greater
220
- rubygems_version: 3.1.6
234
+ rubygems_version: 3.3.26
221
235
  signing_key:
222
236
  specification_version: 4
223
237
  summary: An API to create, read, and manipulate Git repositories