git 1.17.0 → 1.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +21 -47
- data/Rakefile +1 -1
- data/git.gemspec +0 -1
- data/lib/git/branch.rb +62 -49
- data/lib/git/version.rb +1 -1
- data/lib/git.rb +4 -29
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cebf2eab3cc2c8cc605b1e3b9aeafa2f2c82ef0a50be725fc211fdb55a7980c0
|
4
|
+
data.tar.gz: 9df1a5d2f067aa183a65cea1cd21e7260b72213f92c50b60bda26f261b2e7d23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57019fb39b7476d7ee5d97fd1c21f1bffa3b1fbd59413e5bb602794c106f38c2bc528c1a86b98b89bc835976671ea836a1bdf911aa9a281b81b97d221c12b80d
|
7
|
+
data.tar.gz: d2f2927fbdf6b13b66d931183d6effb5fbb651e10c77a393e6b035ccc88e5b6ffd60dbed859fa6c400cd4551df253be89074e20aaa0f40379b609e79bd3553fa
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,22 @@
|
|
5
5
|
|
6
6
|
# Change Log
|
7
7
|
|
8
|
+
## v1.17.2 (2023-03-07)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.17.1..v1.17.2)
|
11
|
+
|
12
|
+
Changes since v1.17.1:
|
13
|
+
|
14
|
+
* f43d6 Fix branch name parsing to handle names that include slashes (#651)
|
15
|
+
|
16
|
+
## v1.17.1 (2023-03-06)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.17.0..v1.17.1)
|
19
|
+
|
20
|
+
Changes since v1.17.0:
|
21
|
+
|
22
|
+
* 774e Revert introduction of ActiveSupport dependency (#649)
|
23
|
+
|
8
24
|
## v1.17.0 (2023-03-05)
|
9
25
|
|
10
26
|
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.16.0..v1.17.0)
|
data/README.md
CHANGED
@@ -3,73 +3,47 @@
|
|
3
3
|
# @title README
|
4
4
|
-->
|
5
5
|
|
6
|
-
# The
|
6
|
+
# The Git Gem
|
7
7
|
|
8
|
-
|
9
|
-
[![Change Log](https://img.shields.io/badge/change%20log-Latest-green)](https://rubydoc.info/gems/git/file/CHANGELOG.md)
|
10
|
-
[![Build Status](https://github.com/ruby-git/ruby-git/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/ruby-git/ruby-git/actions/workflows/continuous_integration.yml)
|
11
|
-
[![Code Climate](https://codeclimate.com/github/ruby-git/ruby-git.png)](https://codeclimate.com/github/ruby-git/ruby-git)
|
12
|
-
[![Source Code](https://img.shields.io/badge/source-GitHub-green)](https://github.com/ruby-git/ruby-git)
|
13
|
-
[![Documentation](https://img.shields.io/badge/documentation-Latest-green)](https://rubydoc.info/gems/git)
|
14
|
-
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/ruby-git/ruby-git/blob/master/LICENSE)
|
15
|
-
|
16
|
-
The git Gem provides an API that can be used to create, read, and manipulate
|
8
|
+
The Git Gem provides an API that can be used to create, read, and manipulate
|
17
9
|
Git repositories by wrapping system calls to the `git` binary. The API can be
|
18
10
|
used for working with Git in complex interactions including branching and
|
19
11
|
merging, object inspection and manipulation, history, patch generation and
|
20
12
|
more.
|
21
13
|
|
22
|
-
##
|
14
|
+
## Homepage
|
23
15
|
|
24
|
-
|
16
|
+
The project source code is at:
|
25
17
|
|
26
|
-
|
27
|
-
* Initializing a new repository with [Git.init](https://rubydoc.info/gems/git/Git#init-class_method)
|
28
|
-
* Cloning a repository with [Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method)
|
18
|
+
http://github.com/ruby-git/ruby-git
|
29
19
|
|
30
|
-
|
20
|
+
## Documentation
|
31
21
|
|
32
|
-
|
22
|
+
Detailed documentation can be found at:
|
33
23
|
|
34
|
-
|
24
|
+
https://rubydoc.info/gems/git/Git.html
|
35
25
|
|
36
|
-
|
37
|
-
gem install git
|
38
|
-
```
|
39
|
-
|
40
|
-
## Deprecation Warnings
|
26
|
+
Get started by obtaining a repository object by:
|
41
27
|
|
42
|
-
|
28
|
+
* opening an existing working copy with [Git.open](https://rubydoc.info/gems/git/Git#open-class_method)
|
29
|
+
* initializing a new repository with [Git.init](https://rubydoc.info/gems/git/Git#init-class_method)
|
30
|
+
* cloning a repository with [Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method)
|
43
31
|
|
44
|
-
|
32
|
+
Methods that can be called on a repository object are documented in [Git::Base](https://rubydoc.info/gems/git/Git/Base)
|
45
33
|
|
46
|
-
|
47
|
-
Git.deprecation.deprecate_methods(Git::Branch, stashes: 'use Git::Base#stash_list instead')
|
48
|
-
```
|
34
|
+
## Install
|
49
35
|
|
50
|
-
|
51
|
-
a **DEPRECATION WARNING** to `$stderr` like the following:
|
36
|
+
You can install Ruby/Git like this:
|
52
37
|
|
53
|
-
```text
|
54
|
-
DEPRECATION WARNING: stashes is deprecated and will be removed from git 2.0.0 (use Git::Base.stash_list instead)
|
55
38
|
```
|
56
|
-
|
57
|
-
The action taken when a deprecated item is used is defined by setting the behavior
|
58
|
-
on the deprecation object:
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
# Log all deprecation warnings to $stderr (the default)
|
62
|
-
Git.deprecation = :stderr
|
63
|
-
|
64
|
-
# Raise an ActiveSupport::DeprecationException
|
65
|
-
Git.deprecation = :raise
|
66
|
-
|
67
|
-
# Do nothing
|
68
|
-
Git.deprecation = :silence
|
39
|
+
sudo gem install git
|
69
40
|
```
|
70
41
|
|
71
|
-
|
72
|
-
|
42
|
+
## Code Status
|
43
|
+
|
44
|
+
* [![Build Status](https://github.com/ruby-git/ruby-git/workflows/CI/badge.svg?branch=master)](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI)
|
45
|
+
* [![Code Climate](https://codeclimate.com/github/ruby-git/ruby-git.png)](https://codeclimate.com/github/ruby-git/ruby-git)
|
46
|
+
* [![Gem Version](https://badge.fury.io/rb/git.svg)](https://badge.fury.io/rb/git)
|
73
47
|
|
74
48
|
## Major Objects
|
75
49
|
|
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'
|
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.
|
data/git.gemspec
CHANGED
@@ -26,7 +26,6 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to?(:required_rubygems_version=)
|
27
27
|
s.requirements = ['git 1.6.0.0, or greater']
|
28
28
|
|
29
|
-
s.add_runtime_dependency 'activesupport', '>= 4.0.0'
|
30
29
|
s.add_runtime_dependency 'addressable', '~> 2.8'
|
31
30
|
s.add_runtime_dependency 'rchardet', '~> 1.8'
|
32
31
|
|
data/lib/git/branch.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
require 'git/path'
|
2
2
|
|
3
3
|
module Git
|
4
|
-
|
5
4
|
class Branch < Path
|
6
|
-
|
7
5
|
attr_accessor :full, :remote, :name
|
8
|
-
|
6
|
+
|
9
7
|
def initialize(base, name)
|
10
8
|
@full = name
|
11
9
|
@base = base
|
@@ -13,25 +11,25 @@ module Git
|
|
13
11
|
@stashes = nil
|
14
12
|
@remote, @name = parse_name(name)
|
15
13
|
end
|
16
|
-
|
14
|
+
|
17
15
|
def gcommit
|
18
16
|
@gcommit ||= @base.gcommit(@full)
|
19
17
|
@gcommit
|
20
18
|
end
|
21
|
-
|
19
|
+
|
22
20
|
def stashes
|
23
21
|
@stashes ||= Git::Stashes.new(@base)
|
24
22
|
end
|
25
|
-
|
23
|
+
|
26
24
|
def checkout
|
27
25
|
check_if_create
|
28
26
|
@base.checkout(@full)
|
29
27
|
end
|
30
|
-
|
28
|
+
|
31
29
|
def archive(file, opts = {})
|
32
30
|
@base.lib.archive(@full, file, opts)
|
33
31
|
end
|
34
|
-
|
32
|
+
|
35
33
|
# g.branch('new_branch').in_branch do
|
36
34
|
# # create new file
|
37
35
|
# # do other stuff
|
@@ -47,26 +45,26 @@ module Git
|
|
47
45
|
end
|
48
46
|
@base.checkout(old_current)
|
49
47
|
end
|
50
|
-
|
48
|
+
|
51
49
|
def create
|
52
50
|
check_if_create
|
53
51
|
end
|
54
|
-
|
52
|
+
|
55
53
|
def delete
|
56
54
|
@base.lib.branch_delete(@name)
|
57
55
|
end
|
58
|
-
|
56
|
+
|
59
57
|
def current
|
60
58
|
determine_current
|
61
59
|
end
|
62
|
-
|
60
|
+
|
63
61
|
def contains?(commit)
|
64
62
|
!@base.lib.branch_contains(commit, self.name).empty?
|
65
63
|
end
|
66
|
-
|
64
|
+
|
67
65
|
def merge(branch = nil, message = nil)
|
68
66
|
if branch
|
69
|
-
in_branch do
|
67
|
+
in_branch do
|
70
68
|
@base.merge(branch, message)
|
71
69
|
false
|
72
70
|
end
|
@@ -76,7 +74,7 @@ module Git
|
|
76
74
|
@base.merge(@name)
|
77
75
|
end
|
78
76
|
end
|
79
|
-
|
77
|
+
|
80
78
|
def update_ref(commit)
|
81
79
|
if @remote
|
82
80
|
@base.lib.update_ref("refs/remotes/#{@remote.name}/#{@name}", commit)
|
@@ -84,47 +82,62 @@ module Git
|
|
84
82
|
@base.lib.update_ref("refs/heads/#{@name}", commit)
|
85
83
|
end
|
86
84
|
end
|
87
|
-
|
85
|
+
|
88
86
|
def to_a
|
89
87
|
[@full]
|
90
88
|
end
|
91
|
-
|
89
|
+
|
92
90
|
def to_s
|
93
91
|
@full
|
94
92
|
end
|
95
|
-
|
96
|
-
private
|
97
93
|
|
98
|
-
|
99
|
-
@base.lib.branch_new(@name) rescue nil
|
100
|
-
end
|
101
|
-
|
102
|
-
def determine_current
|
103
|
-
@base.lib.branch_current == @name
|
104
|
-
end
|
105
|
-
|
106
|
-
# Given a full branch name return an Array containing the remote and branch names.
|
107
|
-
#
|
108
|
-
# Removes 'remotes' from the beggining of the name (if present).
|
109
|
-
# Takes the second part (splittign by '/') as the remote name.
|
110
|
-
# Takes the rest as the repo name (can also hold one or more '/').
|
111
|
-
#
|
112
|
-
# Example:
|
113
|
-
# parse_name('master') #=> [nil, 'master']
|
114
|
-
# parse_name('origin/master') #=> ['origin', 'master']
|
115
|
-
# parse_name('remotes/origin/master') #=> ['origin', 'master']
|
116
|
-
# parse_name('origin/master/v2') #=> ['origin', 'master/v2']
|
117
|
-
#
|
118
|
-
# param [String] name branch full name.
|
119
|
-
# return [<Git::Remote,NilClass,String>] an Array containing the remote and branch names.
|
120
|
-
def parse_name(name)
|
121
|
-
if name.match(/^(?:remotes\/)?([^\/]+)\/(.+)/)
|
122
|
-
return [Git::Remote.new(@base, $1), $2]
|
123
|
-
end
|
94
|
+
private
|
124
95
|
|
125
|
-
|
126
|
-
|
127
|
-
|
96
|
+
def check_if_create
|
97
|
+
@base.lib.branch_new(@name) rescue nil
|
98
|
+
end
|
99
|
+
|
100
|
+
def determine_current
|
101
|
+
@base.lib.branch_current == @name
|
102
|
+
end
|
103
|
+
|
104
|
+
BRANCH_NAME_REGEXP = %r{
|
105
|
+
^
|
106
|
+
# Optional 'refs/remotes/' at the beggining to specify a remote tracking branch
|
107
|
+
# with a <remote_name>. <remote_name> is nil if not present.
|
108
|
+
(?:
|
109
|
+
(?:(?:refs/)?remotes/)(?<remote_name>[^/]+)/
|
110
|
+
)?
|
111
|
+
(?<branch_name>.*)
|
112
|
+
$
|
113
|
+
}x
|
114
|
+
|
115
|
+
# Given a full branch name return an Array containing the remote and branch names.
|
116
|
+
#
|
117
|
+
# Removes 'remotes' from the beggining of the name (if present).
|
118
|
+
# Takes the second part (splittign by '/') as the remote name.
|
119
|
+
# Takes the rest as the repo name (can also hold one or more '/').
|
120
|
+
#
|
121
|
+
# Example:
|
122
|
+
# # local branches
|
123
|
+
# parse_name('master') #=> [nil, 'master']
|
124
|
+
# parse_name('origin/master') #=> [nil, 'origin/master']
|
125
|
+
# parse_name('origin/master/v2') #=> [nil, 'origin/master']
|
126
|
+
#
|
127
|
+
# # remote branches
|
128
|
+
# parse_name('remotes/origin/master') #=> ['origin', 'master']
|
129
|
+
# parse_name('remotes/origin/master/v2') #=> ['origin', 'master/v2']
|
130
|
+
# parse_name('refs/remotes/origin/master') #=> ['origin', 'master']
|
131
|
+
# parse_name('refs/remotes/origin/master/v2') #=> ['origin', 'master/v2']
|
132
|
+
#
|
133
|
+
# param [String] name branch full name.
|
134
|
+
# return [<Git::Remote,NilClass,String>] an Array containing the remote and branch names.
|
135
|
+
def parse_name(name)
|
136
|
+
# Expect this will always match
|
137
|
+
match = name.match(BRANCH_NAME_REGEXP)
|
138
|
+
remote = match[:remote_name] ? Git::Remote.new(@base, match[:remote_name]) : nil
|
139
|
+
branch_name = match[:branch_name]
|
140
|
+
[ remote, branch_name ]
|
141
|
+
end
|
128
142
|
end
|
129
|
-
|
130
143
|
end
|
data/lib/git/version.rb
CHANGED
data/lib/git.rb
CHANGED
@@ -1,32 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
#
|
6
|
-
# A ActiveSupport::Deprecation object used to manage the deprecations scheduled
|
7
|
-
# to be removed in the next major release of the `git`` gem.
|
8
|
-
#
|
9
|
-
# @example Deprecate a method
|
10
|
-
# Git.deprecation.deprecate_methods(Git::Branch, stashes: 'use Git::Base#stash_list instead')
|
11
|
-
#
|
12
|
-
# @example Set the deprecation behavior
|
13
|
-
# # Log all deprecation warnings to $stderr (the default)
|
14
|
-
# Git.deprecation.behavior = :stderr
|
15
|
-
#
|
16
|
-
# # Raise an ActiveSupport::DeprecationException
|
17
|
-
# Git.deprecation.behavior = :raise
|
18
|
-
#
|
19
|
-
# # Do nothing
|
20
|
-
# Git.deprecation.behavior = :raise
|
21
|
-
#
|
22
|
-
# @see https://api.rubyonrails.org/classes/ActiveSupport/Deprecation.html ActiveSupport::Deprecation
|
23
|
-
#
|
24
|
-
# @return [ActiveSupport::Deprecation]
|
25
|
-
#
|
26
|
-
def self.deprecation
|
27
|
-
@deprecation ||= ActiveSupport::Deprecation.new('2.0.0', 'git')
|
28
|
-
end
|
29
|
-
end
|
1
|
+
# Add the directory containing this file to the start of the load path if it
|
2
|
+
# isn't there already.
|
3
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
4
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
30
5
|
|
31
6
|
require 'git/author'
|
32
7
|
require 'git/base'
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.17.
|
4
|
+
version: 1.17.2
|
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-
|
11
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: addressable
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|