Skip to content

Commit ceeba46

Browse files
committed
move git ask pass to env config
1 parent 236de9a commit ceeba46

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

lib/shipit.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ module Shipit
7171
:internal_hook_receivers,
7272
:preferred_org_emails,
7373
:task_execution_strategy,
74-
:task_logger
74+
:task_logger,
75+
:use_git_askpass
7576
)
7677

7778
def task_execution_strategy
@@ -297,6 +298,10 @@ def task_logger
297298
@task_logger ||= Logger.new(nil)
298299
end
299300

301+
def use_git_askpass?
302+
@use_git_askpass.nil? ? true : @use_git_askpass
303+
end
304+
300305
protected
301306

302307
def revision_file

lib/shipit/commands.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def base_env
4141
'GITHUB_TOKEN' => github.token
4242
)
4343

44-
unless Rails.env.development? || Rails.env.test?
44+
if Shipit.use_git_askpass?
4545
env['GIT_ASKPASS'] = Shipit::Engine.root.join('lib', 'snippets', 'git-askpass').realpath.to_s
4646
end
4747

test/dummy/config/environments/development.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
# Raises helpful error messages.
4949
config.assets.raise_runtime_errors = true
5050

51+
# Disable git askpass in development
52+
Shipit.use_git_askpass = false
53+
5154
# Raises error for missing translations
5255
# config.action_view.raise_on_missing_translations = true
5356
if Rails.application.config_for(:database)&.dig('adapter') == 'sqlite3'

test/dummy/config/environments/production.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,7 @@
7676

7777
# Do not dump schema after migrations.
7878
config.active_record.dump_schema_after_migration = false
79+
80+
# Make sure git askpass is enabled in production
81+
Shipit.use_git_askpass = true
7982
end

test/dummy/config/environments/test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
# Print deprecation notices to the stderr.
3333
config.active_support.deprecation = :stderr
3434

35+
# Disable git askpass in test
36+
Shipit.use_git_askpass = false
37+
3538
# Raises error for missing translations
3639
# config.action_view.raise_on_missing_translations = true
3740

0 commit comments

Comments
 (0)