git_lib 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/git/git.rb +13 -5
- data/lib/git/version.rb +1 -1
- data/spec/lib/git/git_spec.rb +12 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83b697a51aa8d99736c92879bb28d0e59f8635e7d32a9e0d9de5c9b6a0a2dc9
|
4
|
+
data.tar.gz: 62649c6cbe804f091acc15cf96e47cbb13521afd44a4cad571e378cbdd051719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a4caae1a2a43f7602ff8b2b0d5d4db07565e2702cc497aabd781e95fff12a845d9568f33ea91db142a0caf8644b6fb7e024fd4cf3bcbf78a1f19a01519f8062
|
7
|
+
data.tar.gz: 3556c067c8d47dcbb0bf641800cf8f095d3fa994830c57169792fa85b6f04dd0720b87a3d8c8bd724d622054dc3c4efb0361ff0384909555109cb38d1abb7ff8
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [2.1.0] - 2021-12-13
|
8
|
+
### Changed
|
9
|
+
- Changed `commit_diff_refs` to handle the `nil` case for `ancestor_ref`
|
10
|
+
|
7
11
|
## [2.0.0] - 2021-08-24
|
8
12
|
### Changed
|
9
13
|
- Add required `repository:` to `GitCommit`.
|
@@ -24,6 +28,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
|
|
24
28
|
- Add magic frozen_string_literal: true comment everywhere.
|
25
29
|
- Clean up Rakefile.
|
26
30
|
|
31
|
+
[2.1.0]: https://github.com/Invoca/git_lib/compare/v2.0.0...v2.1.0
|
27
32
|
[2.0.0]: https://github.com/Invoca/git_lib/compare/v1.2.0...v2.0.0
|
28
33
|
[1.2.0]: https://github.com/Invoca/git_lib/compare/v1.1.1...v1.2.0
|
29
34
|
[1.1.1]: https://github.com/Invoca/git_lib/compare/v1.1.0...v1.1.1
|
data/Gemfile.lock
CHANGED
data/lib/git/git.rb
CHANGED
@@ -150,17 +150,25 @@ module Git
|
|
150
150
|
raw_output.split("\n")
|
151
151
|
end
|
152
152
|
|
153
|
+
def sha_list_for_ref_range(ref, ancestor_ref, fetch: false)
|
154
|
+
commit_diff_refs(ref, ancestor_ref, fetch: fetch).map(&:sha)
|
155
|
+
end
|
156
|
+
|
153
157
|
def commit_diff_refs(ref, ancestor_ref, fetch: false)
|
154
158
|
if fetch
|
155
159
|
fetch_all
|
156
160
|
end
|
157
|
-
|
161
|
+
|
162
|
+
ref_prefix = 'origin/' unless self.class.is_git_sha?(ref)
|
158
163
|
ancestor_ref_prefix = 'origin/' unless self.class.is_git_sha?(ancestor_ref)
|
159
164
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
165
|
+
sha_range = if ancestor_ref
|
166
|
+
"#{ancestor_ref_prefix}#{Shellwords.escape(ancestor_ref)}..#{ref_prefix}#{Shellwords.escape(ref)}"
|
167
|
+
else
|
168
|
+
"#{ref_prefix}#{Shellwords.escape(ref)}"
|
169
|
+
end
|
170
|
+
|
171
|
+
raw_output = execute("log --format=%H\t%an\t%ae\t%aI\t%s --no-color #{sha_range}")
|
164
172
|
raw_output.split("\n").map do |row|
|
165
173
|
commit_data = row.split("\t")
|
166
174
|
GitCommit.new(commit_data[0], commit_data[4], DateTime.iso8601(commit_data[3]), commit_data[1], commit_data[2], repository_name: @repository_name)
|
data/lib/git/version.rb
CHANGED
data/spec/lib/git/git_spec.rb
CHANGED
@@ -426,6 +426,18 @@ RSpec.describe 'Git::Git' do
|
|
426
426
|
)
|
427
427
|
@git.commit_diff_refs('branch`name', 'ancestor`_branch')
|
428
428
|
end
|
429
|
+
|
430
|
+
it 'can get a list of shas given start and end refs' do
|
431
|
+
mocked_output = ["efd778098239838c165ffab2f12ad293f32824c8\tAuthor 1\tauthor1@email.com\t2016-07-14T10:09:45-07:00\tMerge branch 'production'\n",
|
432
|
+
"667f3e5347c48c04663209682642fd8d6d93fde2\tAuthor 2\tauthor2@email.com\t2016-07-14T16:46:35-07:00\tMerge pull request #5584 from Owner/repo/dimension_repair\n"].join
|
433
|
+
expected_array = ["efd778098239838c165ffab2f12ad293f32824c8", "667f3e5347c48c04663209682642fd8d6d93fde2"]
|
434
|
+
mock_execute(
|
435
|
+
mocked_output,
|
436
|
+
1,
|
437
|
+
expected_command: "/usr/bin/git log --format=%H\t%an\t%ae\t%aI\t%s --no-color efd778098239838c165ffab2f12ad293f32824c8..667f3e5347c48c04663209682642fd8d6d93fde2"
|
438
|
+
)
|
439
|
+
expect(@git.sha_list_for_ref_range("667f3e5347c48c04663209682642fd8d6d93fde2", "efd778098239838c165ffab2f12ad293f32824c8")).to eq(expected_array)
|
440
|
+
end
|
429
441
|
end
|
430
442
|
|
431
443
|
describe 'get_current_branch_name' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7'
|
33
|
-
description:
|
33
|
+
description:
|
34
34
|
email:
|
35
35
|
- development@invoca.com
|
36
36
|
executables: []
|
@@ -73,7 +73,7 @@ homepage: https://github.com/Invoca/git_lib
|
|
73
73
|
licenses: []
|
74
74
|
metadata:
|
75
75
|
allowed_push_host: https://rubygems.org
|
76
|
-
post_install_message:
|
76
|
+
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|
79
79
|
- lib
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubygems_version: 3.0.1
|
92
|
-
signing_key:
|
92
|
+
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Git wrapper library.
|
95
95
|
test_files:
|