ohloh_scm 2.3.4 → 2.3.5
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 +4 -4
- data/lib/ohloh_scm/adapters/git/misc.rb +25 -7
- data/lib/ohloh_scm/version.rb +1 -1
- data/log/.gitignore +0 -0
- data/test/repositories/git.tgz +0 -0
- data/test/unit/git_misc_test.rb +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 221f78cfedf3586d06bfea3132d509bb349ff4e1
|
4
|
+
data.tar.gz: 4487e8e5f0fc705b19299129fbc9435c25a92eb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5672b4f5bbe90b94a2aad221b71d016f3a81d791bac1c1c67f7a451152243560f6be11fb108fef64de0b9e341d0c823d662de15fd73d85b4d8bf656ac8053724
|
7
|
+
data.tar.gz: e8a18f49bd52af373cb1150c4c9790d6c8641d9d0a0171756c882927945a9855ec247387e799f2ea4f8d2032e5c50ae38962a2b1c72c4bc5c3ac4b788b23d083
|
@@ -76,14 +76,32 @@ module OhlohScm::Adapters
|
|
76
76
|
|
77
77
|
def tags
|
78
78
|
return [] if no_tags?
|
79
|
-
tag_strings = run("cd #{url} && git tag --format='%(creatordate:iso-strict) %(objectname) %(refname)'").split(/\n/)
|
79
|
+
tag_strings = run("cd #{url} && git tag --format='%(creatordate:iso-strict) %(objectname) %(refname)' | sed 's/refs\\/tags\\///'").split(/\n/)
|
80
80
|
tag_strings.map do |tag_string|
|
81
|
-
timestamp_string, commit_hash,
|
82
|
-
|
83
|
-
timestamp = Time.parse(timestamp_string)
|
84
|
-
tag_name = tag_path.gsub('refs/tags/', '')
|
85
|
-
[tag_name, commit_hash, timestamp]
|
81
|
+
timestamp_string, commit_hash, tag_name = tag_string.split(/\s/)
|
82
|
+
[tag_name, dereferenced_sha(tag_name) || commit_hash, time_object(timestamp_string)]
|
86
83
|
end
|
87
84
|
end
|
88
|
-
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def dereferenced_sha(tag_name)
|
89
|
+
dtag_sha_and_name = dtag_sha_and_names.find { |sha_and_name| sha_and_name.last == tag_name }
|
90
|
+
dtag_sha_and_name.first if dtag_sha_and_name
|
91
|
+
end
|
92
|
+
|
93
|
+
def dtag_sha_and_names
|
94
|
+
@dtag_sha_and_names ||= dereferenced_tag_strings.map(&:split)
|
95
|
+
end
|
96
|
+
|
97
|
+
def dereferenced_tag_strings
|
98
|
+
# Pattern: b6e9220c3cabe53a4ed7f32952aeaeb8a822603d refs/tags/v1.0.0^{}
|
99
|
+
run("cd #{url} && git show-ref --tags -d | grep '\\^{}' | sed 's/\\^{}//' | sed 's/refs\\/tags\\///'").split(/\n/)
|
100
|
+
end
|
101
|
+
|
102
|
+
def time_object(timestamp_string)
|
103
|
+
timestamp_string = '1970-01-01' if timestamp_string.strip.empty?
|
104
|
+
timestamp = Time.parse(timestamp_string)
|
105
|
+
end
|
106
|
+
end
|
89
107
|
end
|
data/lib/ohloh_scm/version.rb
CHANGED
data/log/.gitignore
CHANGED
File without changes
|
data/test/repositories/git.tgz
CHANGED
Binary file
|
data/test/unit/git_misc_test.rb
CHANGED
@@ -45,13 +45,28 @@ module OhlohScm::Adapters
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_fixture_repo_has_dereferenced_tags
|
49
|
+
with_git_repository('git') do |git|
|
50
|
+
tag_shas = git.run("cd #{git.url} && git tag --format='%(objectname)' | sed 's/refs\\/tags\\///'").split(/\n/)
|
51
|
+
assert_equal true, tag_shas.any? { |sha| not git.commit_tokens.include?(sha) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
48
55
|
def test_tags
|
49
56
|
with_git_repository('git') do |git|
|
50
|
-
assert_equal git.tags, [['v1.0.0', '
|
57
|
+
assert_equal git.tags, [['v1.0.0', 'b6e9220c3cabe53a4ed7f32952aeaeb8a822603d', Time.parse('2016-07-31T07:58:30+05:30')],
|
58
|
+
['v1.1.0-lw', '2e9366dd7a786fdb35f211fff1c8ea05c51968b1', Time.parse('2006-06-11T11:34:17-07:00')],
|
51
59
|
['v2.1.0', '1df547800dcd168e589bb9b26b4039bff3a7f7e4', Time.parse('2006-07-14T16:07:15-07:00')]]
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
63
|
+
def test_tags_reference_valid_commits
|
64
|
+
with_git_repository('git') do |git|
|
65
|
+
tag_shas = git.tags.map { |list| list[1] }
|
66
|
+
assert_equal true, tag_shas.all? { |sha| git.commit_tokens.include?(sha) }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
55
70
|
def test_tags_with_non_tagged_repository
|
56
71
|
with_git_repository('git_walk') do |git|
|
57
72
|
assert_equal git.tags, []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohloh_scm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BlackDuck Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: posix-spawn
|