git 2.2.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +93 -8
- data/lib/git/base.rb +23 -2
- data/lib/git/lib.rb +186 -32
- data/lib/git/object.rb +7 -7
- data/lib/git/version.rb +1 -1
- data/lib/git.rb +11 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b62df99d178044fd3fe000a27475819f27bcede65dd96bbc884e1a9eb766df86
|
4
|
+
data.tar.gz: 37330af1ce4f2b8f0ea372cbb36fe32991ab93f5243dbe91589a045f7c5073cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a10a88c4cc04970184c9f5e1eda87dfc4778366498a867931be7196de1a0d882b5d9a7c552249d384ad46e7e1dee2c1077aff1d3ea31e5b53254dbe099e781b
|
7
|
+
data.tar.gz: 76d10cc88dfd8150daaf6f53f1af46077345fa35a64b71c8f6276e388503f1f15fee173dca322ae49c7fb511ebe5d44dc43dd84b15a9a234e2b06aea627e7032
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,30 @@
|
|
5
5
|
|
6
6
|
# Change Log
|
7
7
|
|
8
|
+
## v2.3.1 (2024-10-23)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.3.0..v2.3.1)
|
11
|
+
|
12
|
+
Changes since v2.3.0:
|
13
|
+
|
14
|
+
* e236007 test: allow bin/test-in-docker to accept the test file(s) to run on command line
|
15
|
+
* f4747e1 test: rename bin/tests to bin/test-in-docker
|
16
|
+
* 51f781c test: remove duplicate test from test_stashes.rb
|
17
|
+
* 2e79dbe Fixed "unbranched" stash message support:
|
18
|
+
* da6fa6e Conatinerised the test suite with Docker:
|
19
|
+
* 2e23d47 Update instructions for building a specific version of Git
|
20
|
+
* 70565e3 Add Git.binary_version to return the version of the git command line
|
21
|
+
|
22
|
+
## v2.3.0 (2024-09-01)
|
23
|
+
|
24
|
+
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.2.0..v2.3.0)
|
25
|
+
|
26
|
+
Changes since v2.2.0:
|
27
|
+
|
28
|
+
* f8bc987 Fix windows CI build error
|
29
|
+
* 471f5a8 Sanatize object ref sent to cat-file command
|
30
|
+
* 604a9a2 Make Git::Base#branch work when HEAD is detached
|
31
|
+
|
8
32
|
## v2.2.0 (2024-08-26)
|
9
33
|
|
10
34
|
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.1.1..v2.2.0)
|
data/CONTRIBUTING.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
# @title How To Contribute
|
4
4
|
-->
|
5
5
|
|
6
|
+
# Contributing to the git gem
|
7
|
+
|
8
|
+
* [Summary](#summary)
|
6
9
|
* [How to contribute](#how-to-contribute)
|
7
10
|
* [How to report an issue or request a feature](#how-to-report-an-issue-or-request-a-feature)
|
8
11
|
* [How to submit a code or documentation change](#how-to-submit-a-code-or-documentation-change)
|
@@ -18,10 +21,14 @@
|
|
18
21
|
* [Unit tests](#unit-tests)
|
19
22
|
* [Continuous integration](#continuous-integration)
|
20
23
|
* [Documentation](#documentation)
|
24
|
+
* [Building a specific version of the Git command-line](#building-a-specific-version-of-the-git-command-line)
|
25
|
+
* [Install pre-requisites](#install-pre-requisites)
|
26
|
+
* [Obtain Git source code](#obtain-git-source-code)
|
27
|
+
* [Build git](#build-git)
|
28
|
+
* [Use the new Git version](#use-the-new-git-version)
|
21
29
|
* [Licensing](#licensing)
|
22
30
|
|
23
|
-
|
24
|
-
# Contributing to the git gem
|
31
|
+
## Summary
|
25
32
|
|
26
33
|
Thank you for your interest in contributing to the `ruby-git` project.
|
27
34
|
|
@@ -172,22 +179,100 @@ $ bin/test test_object test_archive
|
|
172
179
|
|
173
180
|
# run all unit tests:
|
174
181
|
$ bin/test
|
182
|
+
|
183
|
+
# run unit tests with a different version of the git command line:
|
184
|
+
$ GIT_PATH=/Users/james/Downloads/git-2.30.2/bin-wrappers bin/test
|
175
185
|
```
|
176
186
|
|
177
187
|
### Continuous integration
|
178
188
|
|
179
|
-
All tests must pass in the project's [GitHub Continuous Integration
|
189
|
+
All tests must pass in the project's [GitHub Continuous Integration
|
190
|
+
build](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI) before the
|
191
|
+
pull request will be merged.
|
180
192
|
|
181
|
-
The [Continuous Integration
|
193
|
+
The [Continuous Integration
|
194
|
+
workflow](https://github.com/ruby-git/ruby-git/blob/master/.github/workflows/continuous_integration.yml)
|
195
|
+
runs both `bundle exec rake default` and `bundle exec rake test:gem` from the
|
196
|
+
project's [Rakefile](https://github.com/ruby-git/ruby-git/blob/master/Rakefile).
|
182
197
|
|
183
198
|
### Documentation
|
184
199
|
|
185
|
-
New and updated public methods must include [YARD](https://yardoc.org/)
|
200
|
+
New and updated public methods must include [YARD](https://yardoc.org/)
|
201
|
+
documentation.
|
202
|
+
|
203
|
+
New and updated public-facing features should be documented in the project's
|
204
|
+
[README.md](README.md).
|
205
|
+
|
206
|
+
## Building a specific version of the Git command-line
|
207
|
+
|
208
|
+
To test with a specific version of the Git command-line, you may need to build that
|
209
|
+
version from source code. The following instructions are adapted from Atlassian’s
|
210
|
+
[How to install Git](https://www.atlassian.com/git/tutorials/install-git) page for
|
211
|
+
building Git on macOS.
|
212
|
+
|
213
|
+
### Install pre-requisites
|
214
|
+
|
215
|
+
Prerequisites only need to be installed if they are not already present.
|
216
|
+
|
217
|
+
From your terminal, install Xcode’s Command Line Tools:
|
218
|
+
|
219
|
+
```shell
|
220
|
+
xcode-select --install
|
221
|
+
```
|
222
|
+
|
223
|
+
Install [Homebrew](http://brew.sh/) by following the instructions on the Homebrew
|
224
|
+
page.
|
225
|
+
|
226
|
+
Using Homebrew, install OpenSSL:
|
227
|
+
|
228
|
+
```shell
|
229
|
+
brew install openssl
|
230
|
+
```
|
231
|
+
|
232
|
+
### Obtain Git source code
|
233
|
+
|
234
|
+
Download and extract the source tarball for the desired Git version from [this source
|
235
|
+
code mirror](https://mirrors.edge.kernel.org/pub/software/scm/git/).
|
236
|
+
|
237
|
+
### Build git
|
238
|
+
|
239
|
+
From your terminal, change to the root directory of the extracted source code and run
|
240
|
+
the build with following command:
|
241
|
+
|
242
|
+
```shell
|
243
|
+
NO_GETTEXT=1 make CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib"
|
244
|
+
```
|
245
|
+
|
246
|
+
The build script will place the newly compiled Git executables in the `bin-wrappers`
|
247
|
+
directory (e.g., `bin-wrappers/git`).
|
248
|
+
|
249
|
+
### Use the new Git version
|
250
|
+
|
251
|
+
To configure programs that use the Git gem to utilize the newly built version, do the
|
252
|
+
following:
|
253
|
+
|
254
|
+
```ruby
|
255
|
+
require 'git'
|
256
|
+
|
257
|
+
# Set the binary path
|
258
|
+
Git.configure { |c| c.binary_path = '/Users/james/Downloads/git-2.30.2/bin-wrappers/git' }
|
259
|
+
|
260
|
+
# Validate the version (if desired)
|
261
|
+
assert_equal([2, 30, 2], Git.binary_version)
|
262
|
+
```
|
263
|
+
|
264
|
+
Tests can be run using the newly built Git version as follows:
|
265
|
+
|
266
|
+
```shell
|
267
|
+
GIT_PATH=/Users/james/Downloads/git-2.30.2/bin-wrappers bin/test
|
268
|
+
```
|
186
269
|
|
187
|
-
|
270
|
+
Note: `GIT_PATH` refers to the directory containing the `git` executable.
|
188
271
|
|
189
272
|
## Licensing
|
190
273
|
|
191
|
-
`ruby-git` uses [the MIT license](https://choosealicense.com/licenses/mit/) as
|
274
|
+
`ruby-git` uses [the MIT license](https://choosealicense.com/licenses/mit/) as
|
275
|
+
declared in the [LICENSE](LICENSE) file.
|
192
276
|
|
193
|
-
Licensing is critical to open-source projects as it ensures the software remains
|
277
|
+
Licensing is critical to open-source projects as it ensures the software remains
|
278
|
+
available under the terms desired by the author.
|
data/lib/git/base.rb
CHANGED
@@ -36,6 +36,20 @@ module Git
|
|
36
36
|
@@config ||= Config.new
|
37
37
|
end
|
38
38
|
|
39
|
+
def self.binary_version(binary_path)
|
40
|
+
git_cmd = "#{binary_path} -c core.quotePath=true -c color.ui=false version 2>&1"
|
41
|
+
result, status = Open3.capture2(git_cmd)
|
42
|
+
result = result.chomp
|
43
|
+
|
44
|
+
if status.success?
|
45
|
+
version = result[/\d+(\.\d+)+/]
|
46
|
+
version_parts = version.split('.').collect { |i| i.to_i }
|
47
|
+
version_parts.fill(0, version_parts.length...3)
|
48
|
+
else
|
49
|
+
raise RuntimeError, "Failed to get git version: #{status}\n#{result}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
39
53
|
# (see Git.init)
|
40
54
|
def self.init(directory = '.', options = {})
|
41
55
|
normalize_paths(options, default_working_directory: directory, default_repository: directory, bare: options[:bare])
|
@@ -650,10 +664,17 @@ module Git
|
|
650
664
|
end
|
651
665
|
|
652
666
|
def cat_file(objectish)
|
653
|
-
self.lib.
|
667
|
+
self.lib.cat_file(objectish)
|
654
668
|
end
|
655
669
|
|
656
|
-
#
|
670
|
+
# The name of the branch HEAD refers to or 'HEAD' if detached
|
671
|
+
#
|
672
|
+
# Returns one of the following:
|
673
|
+
# * The branch name that HEAD refers to (even if it is an unborn branch)
|
674
|
+
# * 'HEAD' if in a detached HEAD state
|
675
|
+
#
|
676
|
+
# @return [String] the name of the branch HEAD refers to or 'HEAD' if detached
|
677
|
+
#
|
657
678
|
def current_branch
|
658
679
|
self.lib.branch_current
|
659
680
|
end
|
data/lib/git/lib.rb
CHANGED
@@ -353,21 +353,105 @@ module Git
|
|
353
353
|
|
354
354
|
alias :namerev :name_rev
|
355
355
|
|
356
|
-
|
357
|
-
|
356
|
+
# Output the contents or other properties of one or more objects.
|
357
|
+
#
|
358
|
+
# @see https://git-scm.com/docs/git-cat-file git-cat-file
|
359
|
+
#
|
360
|
+
# @example Get the contents of a file without a block
|
361
|
+
# lib.cat_file_contents('README.md') # => "This is a README file\n"
|
362
|
+
#
|
363
|
+
# @example Get the contents of a file with a block
|
364
|
+
# lib.cat_file_contents('README.md') { |f| f.read } # => "This is a README file\n"
|
365
|
+
#
|
366
|
+
# @param object [String] the object whose contents to return
|
367
|
+
#
|
368
|
+
# @return [String] the object contents
|
369
|
+
#
|
370
|
+
# @raise [ArgumentError] if object is a string starting with a hyphen
|
371
|
+
#
|
372
|
+
def cat_file_contents(object, &block)
|
373
|
+
assert_args_are_not_options('object', object)
|
374
|
+
|
375
|
+
if block_given?
|
376
|
+
Tempfile.create do |file|
|
377
|
+
# If a block is given, write the output from the process to a temporary
|
378
|
+
# file and then yield the file to the block
|
379
|
+
#
|
380
|
+
command('cat-file', "-p", object, out: file, err: file)
|
381
|
+
file.rewind
|
382
|
+
yield file
|
383
|
+
end
|
384
|
+
else
|
385
|
+
# If a block is not given, return the file contents as a string
|
386
|
+
command('cat-file', '-p', object)
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
alias :object_contents :cat_file_contents
|
391
|
+
|
392
|
+
# Get the type for the given object
|
393
|
+
#
|
394
|
+
# @see https://git-scm.com/docs/git-cat-file git-cat-file
|
395
|
+
#
|
396
|
+
# @param object [String] the object to get the type
|
397
|
+
#
|
398
|
+
# @return [String] the object type
|
399
|
+
#
|
400
|
+
# @raise [ArgumentError] if object is a string starting with a hyphen
|
401
|
+
#
|
402
|
+
def cat_file_type(object)
|
403
|
+
assert_args_are_not_options('object', object)
|
404
|
+
|
405
|
+
command('cat-file', '-t', object)
|
358
406
|
end
|
359
407
|
|
360
|
-
|
361
|
-
|
408
|
+
alias :object_type :cat_file_type
|
409
|
+
|
410
|
+
# Get the size for the given object
|
411
|
+
#
|
412
|
+
# @see https://git-scm.com/docs/git-cat-file git-cat-file
|
413
|
+
#
|
414
|
+
# @param object [String] the object to get the type
|
415
|
+
#
|
416
|
+
# @return [String] the object type
|
417
|
+
#
|
418
|
+
# @raise [ArgumentError] if object is a string starting with a hyphen
|
419
|
+
#
|
420
|
+
def cat_file_size(object)
|
421
|
+
assert_args_are_not_options('object', object)
|
422
|
+
|
423
|
+
command('cat-file', '-s', object).to_i
|
362
424
|
end
|
363
425
|
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
426
|
+
alias :object_size :cat_file_size
|
427
|
+
|
428
|
+
# Return a hash of commit data
|
429
|
+
#
|
430
|
+
# @see https://git-scm.com/docs/git-cat-file git-cat-file
|
431
|
+
#
|
432
|
+
# @param object [String] the object to get the type
|
433
|
+
#
|
434
|
+
# @return [Hash] commit data
|
435
|
+
#
|
436
|
+
# The returned commit data has the following keys:
|
437
|
+
# * tree [String]
|
438
|
+
# * parent [Array<String>]
|
439
|
+
# * author [String] the author name, email, and commit timestamp
|
440
|
+
# * committer [String] the committer name, email, and merge timestamp
|
441
|
+
# * message [String] the commit message
|
442
|
+
# * gpgsig [String] the public signing key of the commit (if signed)
|
443
|
+
#
|
444
|
+
# @raise [ArgumentError] if object is a string starting with a hyphen
|
445
|
+
#
|
446
|
+
def cat_file_commit(object)
|
447
|
+
assert_args_are_not_options('object', object)
|
448
|
+
|
449
|
+
cdata = command_lines('cat-file', 'commit', object)
|
450
|
+
process_commit_data(cdata, object)
|
369
451
|
end
|
370
452
|
|
453
|
+
alias :commit_data :cat_file_commit
|
454
|
+
|
371
455
|
def process_commit_data(data, sha)
|
372
456
|
hsh = {
|
373
457
|
'sha' => sha,
|
@@ -402,12 +486,50 @@ module Git
|
|
402
486
|
end
|
403
487
|
end
|
404
488
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
489
|
+
# Return a hash of annotated tag data
|
490
|
+
#
|
491
|
+
# Does not work with lightweight tags. List all annotated tags in your repository with the following command:
|
492
|
+
#
|
493
|
+
# ```sh
|
494
|
+
# git for-each-ref --format='%(refname:strip=2)' refs/tags | while read tag; do git cat-file tag $tag >/dev/null 2>&1 && echo $tag; done
|
495
|
+
# ```
|
496
|
+
#
|
497
|
+
# @see https://git-scm.com/docs/git-cat-file git-cat-file
|
498
|
+
#
|
499
|
+
# @param object [String] the tag to retrieve
|
500
|
+
#
|
501
|
+
# @return [Hash] tag data
|
502
|
+
#
|
503
|
+
# Example tag data returned:
|
504
|
+
# ```ruby
|
505
|
+
# {
|
506
|
+
# "name" => "annotated_tag",
|
507
|
+
# "object" => "46abbf07e3c564c723c7c039a43ab3a39e5d02dd",
|
508
|
+
# "type" => "commit",
|
509
|
+
# "tag" => "annotated_tag",
|
510
|
+
# "tagger" => "Scott Chacon <schacon@gmail.com> 1724799270 -0700",
|
511
|
+
# "message" => "Creating an annotated tag\n"
|
512
|
+
# }
|
513
|
+
# ```
|
514
|
+
#
|
515
|
+
# The returned commit data has the following keys:
|
516
|
+
# * object [String] the sha of the tag object
|
517
|
+
# * type [String]
|
518
|
+
# * tag [String] tag name
|
519
|
+
# * tagger [String] the name and email of the user who created the tag and the timestamp of when the tag was created
|
520
|
+
# * message [String] the tag message
|
521
|
+
#
|
522
|
+
# @raise [ArgumentError] if object is a string starting with a hyphen
|
523
|
+
#
|
524
|
+
def cat_file_tag(object)
|
525
|
+
assert_args_are_not_options('object', object)
|
526
|
+
|
527
|
+
tdata = command_lines('cat-file', 'tag', object)
|
528
|
+
process_tag_data(tdata, object)
|
409
529
|
end
|
410
530
|
|
531
|
+
alias :tag_data :cat_file_tag
|
532
|
+
|
411
533
|
def process_tag_data(data, name)
|
412
534
|
hsh = { 'name' => name }
|
413
535
|
|
@@ -461,22 +583,6 @@ module Git
|
|
461
583
|
return hsh_array
|
462
584
|
end
|
463
585
|
|
464
|
-
def object_contents(sha, &block)
|
465
|
-
if block_given?
|
466
|
-
Tempfile.create do |file|
|
467
|
-
# If a block is given, write the output from the process to a temporary
|
468
|
-
# file and then yield the file to the block
|
469
|
-
#
|
470
|
-
command('cat-file', "-p", sha, out: file, err: file)
|
471
|
-
file.rewind
|
472
|
-
yield file
|
473
|
-
end
|
474
|
-
else
|
475
|
-
# If a block is not given, return stdout
|
476
|
-
command('cat-file', '-p', sha)
|
477
|
-
end
|
478
|
-
end
|
479
|
-
|
480
586
|
def ls_tree(sha, opts = {})
|
481
587
|
data = { 'blob' => {}, 'tree' => {}, 'commit' => {} }
|
482
588
|
|
@@ -591,8 +697,54 @@ module Git
|
|
591
697
|
files
|
592
698
|
end
|
593
699
|
|
700
|
+
# The state and name of branch pointed to by `HEAD`
|
701
|
+
#
|
702
|
+
# HEAD can be in the following states:
|
703
|
+
#
|
704
|
+
# **:active**: `HEAD` points to a branch reference which in turn points to a
|
705
|
+
# commit representing the tip of that branch. This is the typical state when
|
706
|
+
# working on a branch.
|
707
|
+
#
|
708
|
+
# **:unborn**: `HEAD` points to a branch reference that does not yet exist
|
709
|
+
# because no commits have been made on that branch. This state occurs in two
|
710
|
+
# scenarios:
|
711
|
+
#
|
712
|
+
# * When a repository is newly initialized, and no commits have been made on the
|
713
|
+
# initial branch.
|
714
|
+
# * When a new branch is created using `git checkout --orphan <branch>`, starting
|
715
|
+
# a new branch with no history.
|
716
|
+
#
|
717
|
+
# **:detached**: `HEAD` points directly to a specific commit (identified by its
|
718
|
+
# SHA) rather than a branch reference. This state occurs when you check out a
|
719
|
+
# commit, a tag, or any state that is not directly associated with a branch. The
|
720
|
+
# branch name in this case is `HEAD`.
|
721
|
+
#
|
722
|
+
HeadState = Struct.new(:state, :name)
|
723
|
+
|
724
|
+
# The current branch state which is the state of `HEAD`
|
725
|
+
#
|
726
|
+
# @return [HeadState] the state and name of the current branch
|
727
|
+
#
|
728
|
+
def current_branch_state
|
729
|
+
branch_name = command('branch', '--show-current')
|
730
|
+
return HeadState.new(:detached, 'HEAD') if branch_name.empty?
|
731
|
+
|
732
|
+
state =
|
733
|
+
begin
|
734
|
+
command('rev-parse', '--verify', '--quiet', branch_name)
|
735
|
+
:active
|
736
|
+
rescue Git::FailedError => e
|
737
|
+
raise unless e.result.status.exitstatus == 1 && e.result.stderr.empty?
|
738
|
+
|
739
|
+
:unborn
|
740
|
+
end
|
741
|
+
|
742
|
+
return HeadState.new(state, branch_name)
|
743
|
+
end
|
744
|
+
|
594
745
|
def branch_current
|
595
|
-
|
746
|
+
branch_name = command('branch', '--show-current')
|
747
|
+
branch_name.empty? ? 'HEAD' : branch_name
|
596
748
|
end
|
597
749
|
|
598
750
|
def branch_contains(commit, branch_name="")
|
@@ -982,8 +1134,10 @@ module Git
|
|
982
1134
|
if File.exist?(filename)
|
983
1135
|
File.open(filename) do |f|
|
984
1136
|
f.each_with_index do |line, i|
|
985
|
-
|
986
|
-
|
1137
|
+
_, msg = line.split("\t")
|
1138
|
+
# NOTE this logic may be removed/changed in 3.x
|
1139
|
+
m = msg.match(/^[^:]+:(.*)$/)
|
1140
|
+
arr << [i, (m ? m[1] : msg).strip]
|
987
1141
|
end
|
988
1142
|
end
|
989
1143
|
end
|
data/lib/git/object.rb
CHANGED
@@ -27,7 +27,7 @@ module Git
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def size
|
30
|
-
@size ||= @base.lib.
|
30
|
+
@size ||= @base.lib.cat_file_size(@objectish)
|
31
31
|
end
|
32
32
|
|
33
33
|
# Get the object's contents.
|
@@ -38,9 +38,9 @@ module Git
|
|
38
38
|
# Use this for large files so that they are not held in memory.
|
39
39
|
def contents(&block)
|
40
40
|
if block_given?
|
41
|
-
@base.lib.
|
41
|
+
@base.lib.cat_file_contents(@objectish, &block)
|
42
42
|
else
|
43
|
-
@contents ||= @base.lib.
|
43
|
+
@contents ||= @base.lib.cat_file_contents(@objectish)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -237,7 +237,7 @@ module Git
|
|
237
237
|
def check_commit
|
238
238
|
return if @tree
|
239
239
|
|
240
|
-
data = @base.lib.
|
240
|
+
data = @base.lib.cat_file_commit(@objectish)
|
241
241
|
set_commit(data)
|
242
242
|
end
|
243
243
|
|
@@ -254,7 +254,7 @@ module Git
|
|
254
254
|
end
|
255
255
|
|
256
256
|
def annotated?
|
257
|
-
@annotated ||= (@base.lib.
|
257
|
+
@annotated ||= (@base.lib.cat_file_type(self.name) == 'tag')
|
258
258
|
end
|
259
259
|
|
260
260
|
def message
|
@@ -279,7 +279,7 @@ module Git
|
|
279
279
|
if !self.annotated?
|
280
280
|
@message = @tagger = nil
|
281
281
|
else
|
282
|
-
tdata = @base.lib.
|
282
|
+
tdata = @base.lib.cat_file_tag(@name)
|
283
283
|
@message = tdata['message'].chomp
|
284
284
|
@tagger = Git::Author.new(tdata['tagger'])
|
285
285
|
end
|
@@ -300,7 +300,7 @@ module Git
|
|
300
300
|
return Git::Object::Tag.new(base, sha, objectish)
|
301
301
|
end
|
302
302
|
|
303
|
-
type ||= base.lib.
|
303
|
+
type ||= base.lib.cat_file_type(objectish)
|
304
304
|
klass =
|
305
305
|
case type
|
306
306
|
when /blob/ then Blob
|
data/lib/git/version.rb
CHANGED
data/lib/git.rb
CHANGED
@@ -381,4 +381,15 @@ module Git
|
|
381
381
|
def self.open(working_dir, options = {})
|
382
382
|
Base.open(working_dir, options)
|
383
383
|
end
|
384
|
+
|
385
|
+
# Return the version of the git binary
|
386
|
+
#
|
387
|
+
# @example
|
388
|
+
# Git.binary_version # => [2, 46, 0]
|
389
|
+
#
|
390
|
+
# @return [Array<Integer>] the version of the git binary
|
391
|
+
#
|
392
|
+
def self.binary_version(binary_path = Git::Base.config.binary_path)
|
393
|
+
Base.binary_version(binary_path)
|
394
|
+
end
|
384
395
|
end
|
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: 2.
|
4
|
+
version: 2.3.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: 2024-
|
11
|
+
date: 2024-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -243,8 +243,8 @@ licenses:
|
|
243
243
|
metadata:
|
244
244
|
homepage_uri: http://github.com/ruby-git/ruby-git
|
245
245
|
source_code_uri: http://github.com/ruby-git/ruby-git
|
246
|
-
changelog_uri: https://rubydoc.info/gems/git/2.
|
247
|
-
documentation_uri: https://rubydoc.info/gems/git/2.
|
246
|
+
changelog_uri: https://rubydoc.info/gems/git/2.3.1/file/CHANGELOG.md
|
247
|
+
documentation_uri: https://rubydoc.info/gems/git/2.3.1
|
248
248
|
post_install_message:
|
249
249
|
rdoc_options: []
|
250
250
|
require_paths:
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '0'
|
262
262
|
requirements:
|
263
263
|
- git 2.28.0 or greater
|
264
|
-
rubygems_version: 3.5.
|
264
|
+
rubygems_version: 3.5.16
|
265
265
|
signing_key:
|
266
266
|
specification_version: 4
|
267
267
|
summary: An API to create, read, and manipulate Git repositories
|