retag 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/retag/repo.rb +16 -2
- data/lib/retag/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab9f253e8ff9f3a7bfd637ddaa844cff811d3c75f79fde036bdacd8eb1f58f91
|
4
|
+
data.tar.gz: d36f32cb6b21896c28901f18420ef1ccf4207e4cf2683c42407bebd52662f761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 484c2c98bf6d72545501c1b4b43e139579ee37af5b8f0e1c7e5bf1c28998a8ba4c039fb4a2e7042edbdbf56304420d28b186104863599834c1a6db3ab8c78249
|
7
|
+
data.tar.gz: 390312a1b807c7790a80e4bb5e9f68c6644455b267dcbdd965d260af58106030b9b11cbc1477f21ac78f6a230660e09aef1d32313e94a5301f37b32bef60cd5d
|
data/Gemfile.lock
CHANGED
data/lib/retag/repo.rb
CHANGED
@@ -31,13 +31,27 @@ module Retag
|
|
31
31
|
|
32
32
|
def revision
|
33
33
|
@revision ||= begin
|
34
|
-
|
35
|
-
|
34
|
+
# "^{}" means the object could be a tag. https://mirrors.edge.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions
|
35
|
+
# Example:
|
36
|
+
# git ls-remote git@gir.example.com:repo.git | grep release-latest
|
37
|
+
# 174cf2b6685df563e59c5cd0d367996fcf24f0ae refs/tags/release-latest <-- annotated tag itself
|
38
|
+
# 47208e276cd277896887417a383e05973278438c refs/tags/release-latest^{} <-- WE NEED: original commit tag is references to
|
39
|
+
rev_name_pair = remote_refs(repo, branch+"^{}") # try to find commit tag is references to
|
40
|
+
rev_name_pair ||= remote_refs(repo, branch) # try to find simple branch or commit
|
41
|
+
|
42
|
+
raise "There is no '#{branch}' revision at #{repo}" if rev_name_pair.nil?
|
43
|
+
|
36
44
|
rev, _name = rev_name_pair.split
|
37
45
|
rev[0..7]
|
38
46
|
end
|
39
47
|
end
|
40
48
|
|
49
|
+
private
|
50
|
+
|
51
|
+
def remote_refs repo, branch
|
52
|
+
cmd!("git ls-remote #{repo} #{branch}", capture: true).split("\n").select{|line| line.strip.end_with?("/#{branch}") }.first
|
53
|
+
end
|
54
|
+
|
41
55
|
end
|
42
56
|
end
|
43
57
|
|
data/lib/retag/version.rb
CHANGED