git 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of git might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/continuous_integration.yml +1 -1
- data/CHANGELOG.md +19 -0
- data/Dockerfile.changelog-rs +12 -0
- data/MAINTAINERS.md +0 -1
- data/RELEASING.md +36 -30
- data/git.gemspec +2 -1
- data/lib/git/base.rb +1 -1
- data/lib/git/diff.rb +2 -2
- data/lib/git/encoding_utils.rb +33 -0
- data/lib/git/escaped_path.rb +77 -0
- data/lib/git/lib.rb +13 -35
- data/lib/git/version.rb +1 -1
- data/lib/git.rb +2 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 564087b850fc095e75b62f5fd231d27e7dc145b7839c795d8c84355cb0df0c67
|
4
|
+
data.tar.gz: 0d377c66918e25e2a52f1155db445657452be662553756c3e08cb5d66db29d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6bc7af5d099a33e79afabc655d62faa5e7ce7bcface1843f35a50fbafe2d02a26065b56d5cf2ec26fd7602363a232543ae8a5584952004d8253771a2753fdc
|
7
|
+
data.tar.gz: 732a2e8bbb690279caccc65dcedce95cb378d3554886574fbd71985b09dd77f74d3c82e5f0a71d5af19bddf943dd41b6b5a86be2e847205a26ff1db0ecaa2f1a
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,25 @@
|
|
5
5
|
|
6
6
|
# Change Log
|
7
7
|
|
8
|
+
## v1.11.0
|
9
|
+
|
10
|
+
* 292087e Supress unneeded test output (#570)
|
11
|
+
* 19dfe5e Add support for fetch options "--force/-f" and "--prune-tags/-P". (#563)
|
12
|
+
* 018d919 Fix bug when grepping lines that contain numbers surrounded by colons (#566)
|
13
|
+
* c04d16e remove from maintainer (#567)
|
14
|
+
* 291ca09 Address command line injection in Git::Lib#fetch
|
15
|
+
* 521b8e7 Release v1.10.2 (#561)
|
16
|
+
|
17
|
+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.11.0
|
18
|
+
|
19
|
+
## v1.10.2
|
20
|
+
|
21
|
+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.10.2
|
22
|
+
|
23
|
+
## 1.10.1
|
24
|
+
|
25
|
+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.10.1
|
26
|
+
|
8
27
|
## 1.10.0
|
9
28
|
|
10
29
|
See https://github.com/ruby-git/ruby-git/releases/tag/v1.10.0
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FROM rust
|
2
|
+
|
3
|
+
# Build the docker image (from this project's root directory):
|
4
|
+
# docker build --file Dockerfile.changelog-rs --tag changelog-rs .
|
5
|
+
#
|
6
|
+
# Use this image to output a changelog (from this project's root directory):
|
7
|
+
# docker run --rm --volume "$PWD:/worktree" changelog-rs v1.9.1 v1.10.0
|
8
|
+
|
9
|
+
RUN cargo install changelog-rs
|
10
|
+
WORKDIR /worktree
|
11
|
+
|
12
|
+
ENTRYPOINT ["/usr/local/cargo/bin/changelog-rs", "/worktree"]
|
data/MAINTAINERS.md
CHANGED
data/RELEASING.md
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
# How to release a new git.gem
|
7
7
|
|
8
8
|
Releasing a new version of the `git` gem requires these steps:
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
|
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)
|
12
14
|
|
13
15
|
These instructions use an example where the current release version is `1.5.0`
|
14
16
|
and the new release version to be created is `1.6.0.pre1`.
|
@@ -18,45 +20,49 @@ and the new release version to be created is `1.6.0.pre1`.
|
|
18
20
|
From a fork of ruby-git, create a PR containing changes to (1) bump the
|
19
21
|
version number, (2) update the CHANGELOG.md, and (3) tag the release.
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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.
|
31
33
|
|
32
34
|
## Create a GitHub release
|
33
35
|
|
34
36
|
On [the ruby-git releases page](https://github.com/ruby-git/ruby-git/releases),
|
35
37
|
select `Draft a new release`
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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`
|
49
55
|
|
50
56
|
## Build and release the gem
|
51
57
|
|
52
58
|
Clone [ruby-git/ruby-git](https://github.com/ruby-git/ruby-git) directly (not a
|
53
59
|
fork) and ensure your local working copy is on the master branch
|
54
60
|
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
58
64
|
|
59
65
|
Build the git gem and push it to rubygems.org with the command `rake release`
|
60
66
|
|
61
|
-
|
62
|
-
|
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)
|
data/git.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
|
29
29
|
s.add_runtime_dependency 'rchardet', '~> 1.8'
|
30
30
|
|
31
|
+
s.add_development_dependency 'bump', '~> 0.10'
|
31
32
|
s.add_development_dependency 'minitar', '~> 0.9'
|
32
33
|
s.add_development_dependency 'rake', '~> 13.0'
|
33
34
|
s.add_development_dependency 'test-unit', '~> 3.3'
|
@@ -41,6 +42,6 @@ Gem::Specification.new do |s|
|
|
41
42
|
# Specify which files should be added to the gem when it is released.
|
42
43
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
43
44
|
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
44
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(tests|spec|features)/}) }
|
45
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(tests|spec|features|bin)/}) }
|
45
46
|
end
|
46
47
|
end
|
data/lib/git/base.rb
CHANGED
data/lib/git/diff.rb
CHANGED
@@ -129,8 +129,8 @@ module Git
|
|
129
129
|
final = {}
|
130
130
|
current_file = nil
|
131
131
|
@full_diff.split("\n").each do |line|
|
132
|
-
if m =
|
133
|
-
current_file = m[
|
132
|
+
if m = %r{\Adiff --git ("?)a/(.+?)\1 ("?)b/(.+?)\3\z}.match(line)
|
133
|
+
current_file = Git::EscapedPath.new(m[2]).unescape
|
134
134
|
final[current_file] = defaults.merge({:patch => line, :path => current_file})
|
135
135
|
else
|
136
136
|
if m = /^index ([0-9a-f]{4,40})\.\.([0-9a-f]{4,40})( ......)*/.match(line)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rchardet'
|
4
|
+
|
5
|
+
module Git
|
6
|
+
# Method that can be used to detect and normalize string encoding
|
7
|
+
module EncodingUtils
|
8
|
+
def self.default_encoding
|
9
|
+
__ENCODING__.name
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.best_guess_encoding
|
13
|
+
# Encoding::ASCII_8BIT.name
|
14
|
+
Encoding::UTF_8.name
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.detected_encoding(str)
|
18
|
+
CharDet.detect(str)['encoding'] || best_guess_encoding
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.encoding_options
|
22
|
+
{ invalid: :replace, undef: :replace }
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.normalize_encoding(str)
|
26
|
+
return str if str.valid_encoding? && str.encoding.name == default_encoding
|
27
|
+
|
28
|
+
return str.encode(default_encoding, str.encoding, **encoding_options) if str.valid_encoding?
|
29
|
+
|
30
|
+
str.encode(default_encoding, detected_encoding(str), **encoding_options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Git
|
4
|
+
# Represents an escaped Git path string
|
5
|
+
#
|
6
|
+
# Git commands that output paths (e.g. ls-files, diff), will escape usual
|
7
|
+
# characters in the path with backslashes in the same way C escapes control
|
8
|
+
# characters (e.g. \t for TAB, \n for LF, \\ for backslash) or bytes with values
|
9
|
+
# larger than 0x80 (e.g. octal \302\265 for "micro" in UTF-8).
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Git::GitPath.new('\302\265').unescape # => "µ"
|
13
|
+
#
|
14
|
+
class EscapedPath
|
15
|
+
UNESCAPES = {
|
16
|
+
'a' => 0x07,
|
17
|
+
'b' => 0x08,
|
18
|
+
't' => 0x09,
|
19
|
+
'n' => 0x0a,
|
20
|
+
'v' => 0x0b,
|
21
|
+
'f' => 0x0c,
|
22
|
+
'r' => 0x0d,
|
23
|
+
'e' => 0x1b,
|
24
|
+
'\\' => 0x5c,
|
25
|
+
'"' => 0x22,
|
26
|
+
"'" => 0x27
|
27
|
+
}.freeze
|
28
|
+
|
29
|
+
attr_reader :path
|
30
|
+
|
31
|
+
def initialize(path)
|
32
|
+
@path = path
|
33
|
+
end
|
34
|
+
|
35
|
+
# Convert an escaped path to an unescaped path
|
36
|
+
def unescape
|
37
|
+
bytes = escaped_path_to_bytes(path)
|
38
|
+
str = bytes.pack('C*')
|
39
|
+
str.force_encoding(Encoding::UTF_8)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def extract_octal(path, index)
|
45
|
+
[path[index + 1..index + 4].to_i(8), 4]
|
46
|
+
end
|
47
|
+
|
48
|
+
def extract_escape(path, index)
|
49
|
+
[UNESCAPES[path[index + 1]], 2]
|
50
|
+
end
|
51
|
+
|
52
|
+
def extract_single_char(path, index)
|
53
|
+
[path[index].ord, 1]
|
54
|
+
end
|
55
|
+
|
56
|
+
def next_byte(path, index)
|
57
|
+
if path[index] == '\\' && path[index + 1] >= '0' && path[index + 1] <= '7'
|
58
|
+
extract_octal(path, index)
|
59
|
+
elsif path[index] == '\\' && UNESCAPES.include?(path[index + 1])
|
60
|
+
extract_escape(path, index)
|
61
|
+
else
|
62
|
+
extract_single_char(path, index)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def escaped_path_to_bytes(path)
|
67
|
+
index = 0
|
68
|
+
[].tap do |bytes|
|
69
|
+
while index < path.length
|
70
|
+
byte, chars_used = next_byte(path, index)
|
71
|
+
bytes << byte
|
72
|
+
index += chars_used
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/git/lib.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rchardet'
|
2
1
|
require 'tempfile'
|
3
2
|
require 'zlib'
|
4
3
|
|
@@ -420,7 +419,7 @@ module Git
|
|
420
419
|
|
421
420
|
hsh = {}
|
422
421
|
command_lines('grep', grep_opts).each do |line|
|
423
|
-
if m = /(
|
422
|
+
if m = /(.*?)\:(\d+)\:(.*)/.match(line)
|
424
423
|
hsh[m[1]] ||= []
|
425
424
|
hsh[m[1]] << [m[2].to_i, m[3]]
|
426
425
|
end
|
@@ -876,14 +875,17 @@ module Git
|
|
876
875
|
command('tag', arr_opts)
|
877
876
|
end
|
878
877
|
|
879
|
-
|
880
878
|
def fetch(remote, opts)
|
881
|
-
arr_opts = [
|
882
|
-
arr_opts << opts[:ref] if opts[:ref]
|
879
|
+
arr_opts = []
|
883
880
|
arr_opts << '--tags' if opts[:t] || opts[:tags]
|
884
881
|
arr_opts << '--prune' if opts[:p] || opts[:prune]
|
882
|
+
arr_opts << '--prune-tags' if opts[:P] || opts[:'prune-tags']
|
883
|
+
arr_opts << '--force' if opts[:f] || opts[:force]
|
885
884
|
arr_opts << '--unshallow' if opts[:unshallow]
|
886
885
|
arr_opts << '--depth' << opts[:depth] if opts[:depth]
|
886
|
+
arr_opts << '--'
|
887
|
+
arr_opts << remote
|
888
|
+
arr_opts << opts[:ref] if opts[:ref]
|
887
889
|
|
888
890
|
command('fetch', arr_opts)
|
889
891
|
end
|
@@ -1085,7 +1087,8 @@ module Git
|
|
1085
1087
|
global_opts = []
|
1086
1088
|
global_opts << "--git-dir=#{@git_dir}" if !@git_dir.nil?
|
1087
1089
|
global_opts << "--work-tree=#{@git_work_dir}" if !@git_work_dir.nil?
|
1088
|
-
global_opts << [
|
1090
|
+
global_opts << %w[-c core.quotePath=true]
|
1091
|
+
global_opts << %w[-c color.ui=false]
|
1089
1092
|
|
1090
1093
|
opts = [opts].flatten.map {|s| escape(s) }.join(' ')
|
1091
1094
|
|
@@ -1176,35 +1179,10 @@ module Git
|
|
1176
1179
|
arr_opts
|
1177
1180
|
end
|
1178
1181
|
|
1179
|
-
def default_encoding
|
1180
|
-
__ENCODING__.name
|
1181
|
-
end
|
1182
|
-
|
1183
|
-
def best_guess_encoding
|
1184
|
-
# Encoding::ASCII_8BIT.name
|
1185
|
-
Encoding::UTF_8.name
|
1186
|
-
end
|
1187
|
-
|
1188
|
-
def detected_encoding(str)
|
1189
|
-
CharDet.detect(str)['encoding'] || best_guess_encoding
|
1190
|
-
end
|
1191
|
-
|
1192
|
-
def encoding_options
|
1193
|
-
{ invalid: :replace, undef: :replace }
|
1194
|
-
end
|
1195
|
-
|
1196
|
-
def normalize_encoding(str)
|
1197
|
-
return str if str.valid_encoding? && str.encoding.name == default_encoding
|
1198
|
-
|
1199
|
-
return str.encode(default_encoding, str.encoding, **encoding_options) if str.valid_encoding?
|
1200
|
-
|
1201
|
-
str.encode(default_encoding, detected_encoding(str), **encoding_options)
|
1202
|
-
end
|
1203
|
-
|
1204
1182
|
def run_command(git_cmd, &block)
|
1205
1183
|
return IO.popen(git_cmd, &block) if block_given?
|
1206
1184
|
|
1207
|
-
`#{git_cmd}`.lines.map { |l| normalize_encoding(l) }.join
|
1185
|
+
`#{git_cmd}`.lines.map { |l| Git::EncodingUtils.normalize_encoding(l) }.join
|
1208
1186
|
end
|
1209
1187
|
|
1210
1188
|
def escape(s)
|
@@ -1216,8 +1194,9 @@ module Git
|
|
1216
1194
|
end
|
1217
1195
|
|
1218
1196
|
def escape_for_windows(s)
|
1219
|
-
#
|
1220
|
-
|
1197
|
+
# Escape existing double quotes in s and then wrap the result with double quotes
|
1198
|
+
escaped_string = s.to_s.gsub('"','\\"')
|
1199
|
+
%Q{"#{escaped_string}"}
|
1221
1200
|
end
|
1222
1201
|
|
1223
1202
|
def windows_platform?
|
@@ -1225,6 +1204,5 @@ module Git
|
|
1225
1204
|
win_platform_regex = /mingw|mswin/
|
1226
1205
|
RUBY_PLATFORM =~ win_platform_regex || RUBY_DESCRIPTION =~ win_platform_regex
|
1227
1206
|
end
|
1228
|
-
|
1229
1207
|
end
|
1230
1208
|
end
|
data/lib/git/version.rb
CHANGED
data/lib/git.rb
CHANGED
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.
|
4
|
+
version: 1.11.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:
|
11
|
+
date: 2022-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rchardet
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bump
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.10'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: minitar
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +139,7 @@ files:
|
|
125
139
|
- ".yardopts"
|
126
140
|
- CHANGELOG.md
|
127
141
|
- CONTRIBUTING.md
|
142
|
+
- Dockerfile.changelog-rs
|
128
143
|
- Gemfile
|
129
144
|
- ISSUE_TEMPLATE.md
|
130
145
|
- LICENSE
|
@@ -142,6 +157,8 @@ files:
|
|
142
157
|
- lib/git/branches.rb
|
143
158
|
- lib/git/config.rb
|
144
159
|
- lib/git/diff.rb
|
160
|
+
- lib/git/encoding_utils.rb
|
161
|
+
- lib/git/escaped_path.rb
|
145
162
|
- lib/git/index.rb
|
146
163
|
- lib/git/lib.rb
|
147
164
|
- lib/git/log.rb
|