dapp 0.35.23 → 0.35.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de9a6a59f4ca7c02846087b2048a5764325e882353d5e0ec725832b21adf9fff
4
- data.tar.gz: 1dbfc5b27f38e35762ca15b390237054e5e64e441cb2d6fb67355961086b4ae0
3
+ metadata.gz: be6da76fd071625161bf829c7004669e9d32e1049bc76fbc47e5f4e5405c1121
4
+ data.tar.gz: 6e82c044625221031d1c10094935e48134fe088149ee976a92bc7a6309def346
5
5
  SHA512:
6
- metadata.gz: 6b0d4a4a8bf96e2fc41c72aa325a80155ff237186fbf178a89cf7bef3548e835c66bca3ed4966b3874dba9a9ce65a2f24ac5ac184fc5fd8669f7ec2e29cb178e
7
- data.tar.gz: a9e60783f5e63fc112a604faab32676f5c14500b038eb8eaf0c136a1f4d050bf3c7e3476207214a354c884058684554a18b4787fac7d48d0d9e25daa0f0f80f0
6
+ metadata.gz: c748e01641e9c531840ccc9dd8238dbb04b2acef4340b4698785ff6db7290040979a1153f67fe8d587bce1e65b48ee639864982b27b203215ac322f7e9916dc4
7
+ data.tar.gz: 38bd43546751b84d7962bfb19a8a6e817bc911f168cc335a07db9f62904f3453a37a32a4bd81144882643c83da750bfb45682ebd520a7ca7a79552ba100938ab
@@ -102,9 +102,6 @@ module Dapp
102
102
  def git_url
103
103
  return unless git_own_repo_exist?
104
104
  git_own_repo.remote_origin_url
105
- rescue Dimg::Error::Rugged => e
106
- return if e.net_status[:code] == :git_repository_without_remote_url
107
- raise
108
105
  end
109
106
 
110
107
  def git_own_repo_exist?
@@ -1,14 +1,6 @@
1
1
  module Dapp
2
2
  class Dapp
3
3
  module Chef
4
- def local_git_artifact_exclude_paths(&blk)
5
- super do |exclude_paths|
6
- exclude_paths << '.dapp_chef'
7
-
8
- yield exclude_paths if block_given?
9
- end
10
- end
11
-
12
4
  def builder_cookbook_path
13
5
  path('.dapp_chef')
14
6
  end
@@ -12,16 +12,6 @@ module Dapp
12
12
  end
13
13
  end
14
14
 
15
- def local_git_artifact_exclude_paths(&blk)
16
- super do |exclude_paths|
17
- exclude_paths << 'Dappfile'
18
- exclude_paths << "dappfile.yml"
19
- exclude_paths << "dappfile.yaml"
20
-
21
- yield exclude_paths if block_given?
22
- end
23
- end
24
-
25
15
  def expand_path(path, number = 1)
26
16
  path = File.expand_path(path)
27
17
  number.times.each { path = File.dirname(path) }
@@ -47,7 +47,7 @@ module Dapp
47
47
 
48
48
  def branch_tags
49
49
  return {} unless options[:tag_branch]
50
- raise Error::Dapp, code: :git_branch_without_name if (branch = git_own_repo.branch) == 'HEAD'
50
+ raise Error::Dapp, code: :git_branch_without_name if (branch = git_own_repo.head_branch_name) == 'HEAD'
51
51
  { git_branch: [branch] }
52
52
  end
53
53
 
@@ -58,13 +58,12 @@ module Dapp
58
58
  }.tap {|extra|
59
59
  if git_own_repo_exist?
60
60
  extra["git"] = {}.tap do |extra_git|
61
- if git_own_repo.tracked_remote_repository?
61
+ if git_own_repo.remote_origin_url
62
62
  extra_git["remote_origin_url"] = git_own_repo.remote_origin_url, # may contain https token
63
63
  extra_git["name"] = self.git_url_to_name(git_own_repo.remote_origin_url)
64
64
  end
65
65
 
66
66
  extra_git["path"] = git_own_repo.path
67
- extra_git["workdir_path"] = git_own_repo.workdir_path
68
67
  extra_git["latest_commit"] = git_own_repo.head_commit unless git_own_repo.empty?
69
68
  end
70
69
  end
@@ -84,7 +83,7 @@ module Dapp
84
83
  "dapp-build-cache-version" => ::Dapp::BUILD_CACHE_VERSION,
85
84
  "dapp-command" => self.options[:dapp_command],
86
85
  }.tap {|tags|
87
- if git_own_repo_exist? && git_own_repo.tracked_remote_repository?
86
+ if git_own_repo_exist? && git_own_repo.remote_origin_url
88
87
  tags["git-host"] = self.get_host_from_git_url(git_own_repo.remote_origin_url)
89
88
 
90
89
  git_name = self.git_url_to_name(git_own_repo.remote_origin_url)
@@ -3,8 +3,6 @@ module Dapp
3
3
  module Build
4
4
  module Stage
5
5
  class GAArchive < GABase
6
- RESET_COMMIT_MESSAGES = ['[dapp reset]', '[reset dapp]'].freeze
7
-
8
6
  def initialize(dimg, next_stage)
9
7
  @prev_stage = BeforeInstallArtifact.new(dimg, self)
10
8
  super
@@ -22,8 +20,7 @@ module Dapp
22
20
  protected
23
21
 
24
22
  def reset_commits
25
- regex = Regexp.union(RESET_COMMIT_MESSAGES)
26
- dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message(regex) }.compact.sort.uniq
23
+ dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message('(\[dapp reset\])|(\[reset dapp\])') }.compact.sort.uniq
27
24
  end
28
25
 
29
26
  def apply_command_method
@@ -13,9 +13,12 @@ module Dapp
13
13
  @name = name
14
14
  end
15
15
 
16
+ def exclude_paths
17
+ []
18
+ end
19
+
16
20
  def get_ruby2go_state_hash
17
21
  {
18
- "Dapp" => dapp.get_ruby2go_state_hash,
19
22
  "Name" => @name.to_s,
20
23
  }
21
24
  end
@@ -24,208 +27,50 @@ module Dapp
24
27
  @name = state["Name"]
25
28
  end
26
29
 
27
- def exclude_paths
28
- []
29
- end
30
-
31
- def remote_origin_url
32
- @remote_origin_url ||= begin
33
- ro_url = url
34
- while url_protocol(ro_url) == :noname
35
- begin
36
- parent_git = Rugged::Repository.discover(ro_url)
37
- rescue Rugged::OSError
38
- parent_git_path = parent_git ? parent_git.path : path
39
- raise Error::Rugged, code: :git_repository_not_found, data: { path: ro_url, parent_git_path: parent_git_path }
40
- end
41
-
42
- ro_url = begin
43
- git_url(parent_git)
44
- rescue Error::Rugged => e
45
- break if e.net_status[:code] == :git_repository_without_remote_url # local repository
46
- raise
47
- end
48
- end
49
-
50
- ro_url
51
- end
52
- end
53
-
54
- def remote_origin_url_protocol
55
- url_protocol(remote_origin_url)
56
- end
57
-
58
- def nested_git_directories_patches(*_args)
59
- raise
60
- end
61
-
62
- def submodules_params(commit, paths: [], exclude_paths: [])
63
- raise "Workdir not supported for `#{self.class}` repository" if commit.nil?
64
- submodules(commit, paths: paths, exclude_paths: exclude_paths).map(&method(:submodule_params))
65
- end
66
-
67
- def submodule_params(submodule)
68
- {}.tap do |params|
69
- params[:path] = submodule.path
70
- params[:url] = begin
71
- params_url = submodule_url(submodule.url)
72
- params_url = "#{params_url}.git" if url_protocol(params[:url]) != :noname && !params_url.end_with?('.git')
73
- params_url
74
- end # https://github.com/libgit2/rugged/issues/761
75
-
76
- params[:type] = begin
77
- if url_protocol(params[:url]) == :noname
78
- submodule_absolute_path = File.join(File.dirname(path), params[:path])
79
- dapp.log_warning(desc: { code: :submodule_url_scheme_not_detected,
80
- data: { url: params[:url], path: submodule_absolute_path } })
81
- :local
82
- else
83
- :remote
84
- end
85
- end
86
- params[:commit] = submodule.head_oid
87
- end
88
- end
89
-
90
- def submodules(commit, paths: [], exclude_paths: [])
91
- Rugged::SubmoduleCollection.new(submodules_git(commit)).select do |submodule|
92
- next false if ignore_directory?(submodule.path, paths: paths, exclude_paths: exclude_paths)
93
- next true if submodule.in_config?
94
- dapp.log_warning(desc: { code: :submodule_mapping_not_found,
95
- data: { path: submodule.path, repo: name } })
96
- end
97
- end
98
-
99
- def submodules_git(commit)
100
- submodules_git_path(commit).tap do |git_path|
101
- break begin
102
- if git_path.directory?
103
- Rugged::Repository.new(git_path.to_s)
104
- else
105
- Rugged::Repository.clone_at(path.to_s, git_path.to_s).tap do |submodules_git|
106
- begin
107
- submodules_git.checkout(commit, strategy: :force)
108
- rescue Rugged::ReferenceError
109
- raise_submodule_commit_not_found!(commit)
110
- end
111
- end
112
- end
113
- end
114
- end
115
- end
116
-
117
- def submodules_git_path(commit)
118
- Pathname(File.join(dapp.host_docker_tmp_config_dir, "submodule", dapp.consistent_uniq_slugify(name), commit).to_s)
119
- end
120
-
121
- def raise_submodule_commit_not_found!(_)
122
- raise
30
+ def empty?
31
+ return @empty if !@empty.nil?
32
+ @empty = ruby2go_method("IsEmpty")
33
+ @empty
123
34
  end
124
35
 
125
- def submodule_url(gitsubmodule_url)
126
- if gitsubmodule_url.start_with?('../')
127
- case remote_origin_url_protocol
128
- when :http, :https, :git
129
- uri = URI.parse(remote_origin_url)
130
- uri.path = File.expand_path(File.join(uri.path, gitsubmodule_url))
131
- uri.to_s
132
- when :ssh
133
- host_with_user, group_and_project = remote_origin_url.split(':', 2)
134
- group_and_project = File.expand_path(File.join('/', group_and_project, gitsubmodule_url))[1..-1]
135
- [host_with_user, group_and_project].join(':')
136
- else
137
- raise
138
- end
139
- else
140
- gitsubmodule_url
141
- end
36
+ def find_commit_id_by_message(regex)
37
+ ruby2go_method("FindCommitIdByMessage", "regex" => regex)
142
38
  end
143
39
 
144
- # FIXME: Убрать логику исключения путей exclude_paths из данного класса,
145
- # FIXME: т.к. большинство методов не поддерживают инвариант
146
- # FIXME "всегда выдавать данные с исключенными путями".
147
- # FIXME: Например, метод diff выдает данные без учета exclude_paths.
148
- # FIXME: Лучше перенести фильтрацию в GitArtifact::diff_patches.
149
- # FIXME: ИЛИ обеспечить этот инвариант, но это ограничит в возможностях
150
- # FIXME: использование Rugged извне этого класса и это более сложный путь.
151
- # FIXME: Лучше сейчас убрать фильтрацию, а добавить ее когда наберется достаточно
152
- # FIXME: примеров использования.
153
-
154
- def patches(from, to, paths: [], exclude_paths: [], **kwargs)
155
- diff(from, to, **kwargs).patches.select do |patch|
156
- !ignore_patch?(patch, paths: paths, exclude_paths: exclude_paths)
157
- end
40
+ def commit_exists?(commit)
41
+ ruby2go_method("IsCommitExists", "commit" => commit)
158
42
  end
159
43
 
160
- def ignore_patch?(patch, paths: [], exclude_paths: [])
161
- ignore_path?(patch.delta.new_file[:path], paths: paths, exclude_paths: exclude_paths)
162
- end
44
+ def remote_origin_url
45
+ return @remote_origin_url if @remote_origin_url_set
163
46
 
164
- def blobs_entries(commit, paths: [], exclude_paths: [])
165
- [].tap do |entries|
166
- lookup_commit(commit).tree.walk_blobs(:preorder) do |root, entry|
167
- fullpath = File.join(root, entry[:name]).reverse.chomp('/').reverse
168
- next if ignore_path?(fullpath, paths: paths, exclude_paths: exclude_paths)
169
- entries << [root, entry]
170
- end
47
+ res = ruby2go_method("RemoteOriginUrl")
48
+ if res != ""
49
+ @remote_origin_url = res
171
50
  end
172
- end
51
+ @remote_origin_url_set = true
173
52
 
174
- def diff(from, to, **kwargs)
175
- if to.nil?
176
- raise "Workdir diff not supported for #{self.class}"
177
- elsif from.nil?
178
- Rugged::Tree.diff(git, nil, to, **kwargs)
179
- else
180
- lookup_commit(from).diff(lookup_commit(to), **kwargs)
181
- end
53
+ @remote_origin_url
182
54
  end
183
55
 
184
- def commit_exists?(commit)
185
- git.exists?(commit)
56
+ def latest_branch_commit(branch)
57
+ ruby2go_method("LatestBranchCommit", "branch" => branch)
186
58
  end
187
59
 
188
60
  def head_commit
189
- git.head.target_id
190
- end
191
-
192
- def latest_branch_commit(_)
193
- raise
194
- end
195
-
196
- def latest_tag_commit(_)
197
- raise
198
- end
199
-
200
- def branch
201
- git.head.name.sub(/^refs\/heads\//, '')
202
- rescue Rugged::ReferenceError => e
203
- raise Error::Rugged, code: :git_repository_reference_error, data: { name: name, message: e.message.downcase }
204
- end
205
-
206
- def tags
207
- git.tags.map(&:name)
61
+ return @head_commit if !@head_commit.nil?
62
+ @head_commit = ruby2go_method("HeadCommit")
63
+ @head_commit
208
64
  end
209
65
 
210
- def remote_branches
211
- git.branches
212
- .map(&:name)
213
- .select { |b| b.start_with?('origin/') }
214
- .map { |b| b.reverse.chomp('origin/'.reverse).reverse }
66
+ def head_branch_name
67
+ return @branch if !@branch.nil?
68
+ @branch = ruby2go_method("HeadBranchName")
69
+ @branch
215
70
  end
216
71
 
217
- def find_commit_id_by_message(regex)
218
- walker.each do |commit|
219
- msg = commit.message.encode('UTF-8', invalid: :replace, undef: :replace)
220
- return commit.oid if msg =~ regex
221
- end
222
- end
223
-
224
- def walker
225
- walker = Rugged::Walker.new(git)
226
- walker.push(git.head.target_id)
227
- walker
228
- end
72
+ # TODO Below operations does not affect build process, only used in sample.
73
+ # TODO Should be ported to golang without git_repo.GitRepo interface.
229
74
 
230
75
  def lookup_object(oid)
231
76
  git.lookup(oid)
@@ -235,54 +80,16 @@ module Dapp
235
80
  git.lookup(commit)
236
81
  end
237
82
 
238
- def empty?
239
- git.empty?
240
- end
241
-
242
- def tracked_remote_repository?
243
- !git.remotes.to_a.empty?
244
- end
245
-
246
83
  protected
247
84
 
248
- def git(**kwargs)
249
- @git ||= Rugged::Repository.new(path.to_s, **kwargs)
250
- end
251
-
252
- def url
253
- @url ||= git_config_remote_origin_url(git)
254
- end
255
-
256
- def git_url(git_repo)
257
- git_config_remote_origin_url(git_repo)
258
- end
259
-
260
- def git_config_remote_origin_url(git_repo)
261
- git_repo.config.to_hash['remote.origin.url'].tap do |url|
262
- raise Error::Rugged, code: :git_repository_without_remote_url, data: { name: self.class, path: git_repo.path } if url.nil?
263
- end
264
- end
265
-
266
- def url_protocol(url)
267
- if (scheme = URI.parse(url).scheme).nil?
268
- :noname
269
- else
270
- scheme.to_sym
271
- end
272
- rescue URI::InvalidURIError
273
- :ssh
274
- rescue Error::Rugged => e
275
- return :none if e.net_status[:code] == :git_repository_without_remote_url
85
+ def ruby2go_method(method, args_hash={})
276
86
  raise
277
87
  end
278
88
 
279
- private
280
-
281
- def ignore_directory?(path, paths: [], exclude_paths: [])
282
- ignore_path_base(path, exclude_paths: exclude_paths) do
283
- paths.empty? || paths.any? { |p| check_path?(path, p) || check_subpath?(path, p) }
284
- end
89
+ def git(**kwargs) # TODO remove
90
+ @git ||= Rugged::Repository.new(path.to_s, **kwargs)
285
91
  end
92
+
286
93
  end
287
94
  end
288
95
  end
@@ -18,75 +18,20 @@ module Dapp
18
18
  }
19
19
  end
20
20
 
21
- def path=(path)
22
- @path ||= Pathname(Rugged::Repository.new(path).path)
23
- rescue Rugged::RepositoryError, Rugged::OSError => _e
24
- raise Error::Rugged, code: :local_git_repository_does_not_exist, data: { path: path }
25
- end
26
-
27
- def workdir_path
28
- Pathname(git.workdir)
29
- end
30
-
31
- def nested_git_directories_patches(paths: [], exclude_paths: [], **kwargs)
32
- patches(nil, nil, paths: paths, exclude_paths: exclude_paths, **kwargs).select do |patch|
33
- delta_new_file = patch.delta.new_file
34
- nested_git_repository_mode?(delta_new_file[:mode])
35
- end
36
- end
37
-
38
- def submodules_params(commit, paths: [], exclude_paths: [])
39
- submodules(commit, paths: paths, exclude_paths: exclude_paths).map do |submodule|
40
- submodule_params(submodule).tap do |params|
41
- params[:commit] = submodule.workdir_oid || params[:commit] if commit.nil?
42
- if submodule.in_workdir? && !submodule.uninitialized?
43
- dapp.log_info("Using local submodule repository `#{params[:path]}`!")
44
- params[:type] = :local
45
- end
46
- end
47
- end.compact
48
- end
49
-
50
- def submodules_git(commit)
51
- if commit.nil?
52
- git
53
- else
54
- super
55
- end
56
- end
21
+ def ruby2go_method(method, args_hash={})
22
+ res = dapp.ruby2go_git_repo(args_hash.merge("LocalGitRepo" => JSON.dump(get_ruby2go_state_hash), "method" => method))
57
23
 
58
- def raise_submodule_commit_not_found!(commit)
59
- raise Error::Rugged, code: :git_local_submodule_commit_not_found, data: { commit: commit, path: path }
60
- end
24
+ raise res["error"] if res["error"]
61
25
 
62
- def ignore_patch?(patch, paths: [], exclude_paths: [])
63
- delta_new_file = patch.delta.new_file
64
- args = [delta_new_file[:path], paths: paths, exclude_paths: exclude_paths]
65
- if nested_git_repository_mode?(delta_new_file[:mode])
66
- ignore_directory?(*args)
67
- else
68
- ignore_path?(*args)
69
- end
70
- end
26
+ self.set_ruby2go_state_hash(JSON.load(res["data"]["LocalGitRepo"]))
71
27
 
72
- def nested_git_repository_mode?(mode)
73
- mode == 0o040000
28
+ res["data"]["result"]
74
29
  end
75
30
 
76
- # NOTICE: Параметры {from: nil, to: nil} можно указать только для Own repo.
77
- # NOTICE: Для Remote repo такой вызов не имеет смысла и это ошибка пользователя класса Remote.
78
-
79
- def diff(from, to, **kwargs)
80
- if from.nil? and to.nil?
81
- mid_commit = head_commit
82
- diff_obj = super(nil, mid_commit, **kwargs)
83
- diff_obj.merge! git.lookup(mid_commit).diff_workdir(**kwargs)
84
- diff_obj
85
- elsif to.nil?
86
- git.lookup(from).diff_workdir(**kwargs)
87
- else
88
- super
89
- end
31
+ def path=(path) # TODO remove
32
+ @path ||= Pathname(Rugged::Repository.new(path).path)
33
+ rescue Rugged::RepositoryError, Rugged::OSError => _e
34
+ raise Error::Rugged, code: :local_git_repository_does_not_exist, data: { path: path }
90
35
  end
91
36
 
92
37
  def lookup_commit(commit)
@@ -94,15 +39,6 @@ module Dapp
94
39
  rescue Rugged::OdbError, TypeError => _e
95
40
  raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit, path: path }
96
41
  end
97
-
98
- protected
99
-
100
- def git_repo_exist?(path)
101
- Rugged::Repository.new(path)
102
- true
103
- rescue Rugged::RepositoryError, Rugged::OSError => _e
104
- false
105
- end
106
42
  end
107
43
  end
108
44
  end
@@ -9,10 +9,6 @@ module Dapp
9
9
  def exclude_paths
10
10
  dapp.local_git_artifact_exclude_paths
11
11
  end
12
-
13
- def submodules_git(_)
14
- git
15
- end
16
12
  end
17
13
  end
18
14
  end
@@ -2,7 +2,7 @@ module Dapp
2
2
  module Dimg
3
3
  module GitRepo
4
4
  class Remote < Base
5
- CACHE_VERSION = 3
5
+ CACHE_VERSION = 4
6
6
 
7
7
  attr_reader :url
8
8
 
@@ -22,6 +22,10 @@ module Dapp
22
22
  @url = url
23
23
  end
24
24
 
25
+ def url
26
+ @url ||= remote_origin_url
27
+ end
28
+
25
29
  def ruby2go_method(method, args_hash={})
26
30
  res = dapp.ruby2go_git_repo(args_hash.merge("RemoteGitRepo" => JSON.dump(get_ruby2go_state_hash), "method" => method))
27
31
 
@@ -35,7 +39,7 @@ module Dapp
35
39
  def get_ruby2go_state_hash
36
40
  super.tap {|res|
37
41
  res["Url"] = @url.to_s
38
- res["ClonePath"] = dapp.build_path("remote_git_repo", CACHE_VERSION.to_s, dapp.consistent_uniq_slugify(name), remote_origin_url_protocol).to_s # FIXME
42
+ res["ClonePath"] = dapp.build_path("remote_git_repo", CACHE_VERSION.to_s, dapp.consistent_uniq_slugify(name), url_protocol(url)).to_s # FIXME
39
43
  res["IsDryRun"] = dapp.dry_run?
40
44
  }
41
45
  end
@@ -45,13 +49,9 @@ module Dapp
45
49
  @url = state["Url"]
46
50
  end
47
51
 
48
- def _with_lock(&blk)
49
- dapp.lock("remote_git_artifact.#{name}", default_timeout: 600, &blk)
50
- end
51
-
52
- def _rugged_credentials
52
+ def _rugged_credentials # TODO remove
53
53
  @_rugged_credentials ||= begin
54
- if remote_origin_url_protocol == :ssh
54
+ if url_protocol(url) == :ssh
55
55
  host_with_user = url.split(':', 2).first
56
56
  username = host_with_user.split('@', 2).reverse.last
57
57
  Rugged::Credentials::SshKeyFromAgent.new(username: username)
@@ -60,46 +60,38 @@ module Dapp
60
60
  end
61
61
 
62
62
  def path
63
- Pathname(dapp.build_path("remote_git_repo", CACHE_VERSION.to_s, dapp.consistent_uniq_slugify(name), remote_origin_url_protocol).to_s)
63
+ Pathname(dapp.build_path("remote_git_repo", CACHE_VERSION.to_s, dapp.consistent_uniq_slugify(name), url_protocol(url)).to_s)
64
64
  end
65
65
 
66
66
  def clone_and_fetch
67
67
  return ruby2go_method("CloneAndFetch")
68
68
  end
69
69
 
70
- def latest_branch_commit(branch)
71
- git.ref("refs/remotes/#{branch_format(branch)}").tap do |ref|
72
- raise Error::Rugged, code: :branch_not_exist_in_remote_git_repository, data: { branch: branch, url: url } if ref.nil?
73
- break ref.target_id
74
- end
75
- end
76
-
77
- def latest_tag_commit(tag)
78
- git.tags[tag].tap do |t|
79
- raise Error::Rugged, code: :tag_not_exist_in_remote_git_repository, data: { tag: tag, url: url } if t.nil?
80
- break t.target_id
81
- end
82
- end
83
-
84
70
  def lookup_commit(commit)
85
71
  super
86
72
  rescue Rugged::OdbError, TypeError => _e
87
73
  raise Error::Rugged, code: :commit_not_found_in_remote_git_repository, data: { commit: commit, url: url }
88
74
  end
89
75
 
90
- def raise_submodule_commit_not_found!(commit)
91
- raise Error::Rugged, code: :git_remote_submodule_commit_not_found, data: { commit: commit, url: url }
92
- end
93
-
94
76
  protected
95
77
 
96
- def git
78
+ def git # TODO remove
97
79
  super(bare: true, credentials: _rugged_credentials)
98
80
  end
99
81
 
100
82
  private
101
83
 
102
- def branch_format(name)
84
+ def url_protocol(url) # TODO remove
85
+ if (scheme = URI.parse(url).scheme).nil?
86
+ :noname
87
+ else
88
+ scheme.to_sym
89
+ end
90
+ rescue URI::InvalidURIError
91
+ :ssh
92
+ end
93
+
94
+ def branch_format(name) # TODO remove
103
95
  "origin/#{name.reverse.chomp('origin/'.reverse).reverse}"
104
96
  end
105
97
  end
@@ -38,8 +38,8 @@ module Dapp
38
38
  elsif ENV["CI_COMMIT_REF_NAME"]
39
39
  ci_info["branch"] = ci_info["ref"] = ENV["CI_COMMIT_REF_NAME"]
40
40
  ci_info["is_branch"] = true
41
- elsif dapp.git_own_repo_exist? and dapp.git_own_repo.branch != "HEAD"
42
- ci_info["branch"] = ci_info["ref"] = dapp.git_own_repo.branch
41
+ elsif dapp.git_own_repo_exist? and dapp.git_own_repo.head_branch_name != "HEAD"
42
+ ci_info["branch"] = ci_info["ref"] = dapp.git_own_repo.head_branch_name
43
43
  ci_info["is_branch"] = true
44
44
  elsif dapp.git_own_repo_exist?
45
45
  git = dapp.git_own_repo.send(:git)
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.35.23"
2
+ VERSION = "0.35.24"
3
3
  BUILD_CACHE_VERSION = 31
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.23
4
+ version: 0.35.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout