Skip to content

Commit fb8d516

Browse files
committed
fix: use Git::Deprecation.warn for deprecated methods (fixes #842)
1 parent 4a03b5c commit fb8d516

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/git/base.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ def local_branch?(branch)
286286
end
287287

288288
def is_local_branch?(branch) # rubocop:disable Naming/PredicatePrefix
289-
Git.deprecation('Git::Base#is_local_branch? is deprecated. Use Git::Base#local_branch? instead.')
289+
Git::Deprecation.warn(
290+
'Git::Base#is_local_branch? is deprecated and will be removed in a future version. ' \
291+
'Use Git::Base#local_branch? instead.'
292+
)
290293
local_branch?(branch)
291294
end
292295

@@ -297,7 +300,10 @@ def remote_branch?(branch)
297300
end
298301

299302
def is_remote_branch?(branch) # rubocop:disable Naming/PredicatePrefix
300-
Git.deprecated('Git::Base#is_remote_branch? is deprecated. Use Git::Base#remote_branch? instead.')
303+
Git::Deprecation.warn(
304+
'Git::Base#is_remote_branch? is deprecated and will be removed in a future version. ' \
305+
'Use Git::Base#remote_branch? instead.'
306+
)
301307
remote_branch?(branch)
302308
end
303309

@@ -308,7 +314,10 @@ def branch?(branch)
308314
end
309315

310316
def is_branch?(branch) # rubocop:disable Naming/PredicatePrefix
311-
Git.deprecated('Git::Base#is_branch? is deprecated. Use Git::Base#branch? instead.')
317+
Git::Deprecation.warn(
318+
'Git::Base#is_branch? is deprecated and will be removed in a future version. ' \
319+
'Use Git::Base#branch? instead.'
320+
)
312321
branch?(branch)
313322
end
314323

lib/git/object.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ def diff_parent
213213
end
214214

215215
def set_commit(data) # rubocop:disable Naming/AccessorMethodName
216-
Git.deprecation('Git::Object::Commit#set_commit is deprecated. Use #from_data instead.')
216+
Git::Deprecation.warn(
217+
'Git::Object::Commit#set_commit is deprecated and will be removed in a future version. ' \
218+
'Use #from_data instead.'
219+
)
217220
from_data(data)
218221
end
219222

0 commit comments

Comments
 (0)