Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #669 from fastlane/git_repo_cleaner
Browse files Browse the repository at this point in the history
Disable a bunch of git resets
  • Loading branch information
taquitos committed Apr 14, 2018
2 parents 48d48ad + 2c12665 commit c74bd97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 0 additions & 7 deletions app/features/build_runner/build_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def checkout_sha(&completion_block)
use_global_git_mutex: false
)
else
repo.reset_hard!
logger.debug("Pulling `master` in checkout_sha")
repo.pull
end
Expand Down Expand Up @@ -221,14 +220,8 @@ def set_build_specific_env_variable(key:, value:)
environment_variables_set << key
end

def reset_repo_state
# When we're done, clean up by resetting
repo.reset_hard!
end

def post_run_action
logger.debug("Finished running #{project.project_name} for #{sha}")
reset_repo_state

unset_build_specific_environment_variables
end
Expand Down
7 changes: 2 additions & 5 deletions app/shared/models/git_repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,8 @@ def checkout_commit(sha: nil, repo_auth: self.repo_auth, use_global_git_mutex: t

success = false
begin
git.reset_hard(
git.gcommit(sha)
)
git.gcommit(sha)

success = true
rescue StandardError => ex
exception_context = { sha: sha }
Expand Down Expand Up @@ -599,10 +598,8 @@ def fetch(use_global_git_mutex: true)
def switch_to_fork(clone_url:, branch:, sha: nil, local_branch_name:, use_global_git_mutex: false)
perform_block(use_global_git_mutex: use_global_git_mutex) do
logger.debug("Switching to branch #{branch} from forked repo: #{clone_url} (pulling into #{local_branch_name})")
reset_hard!(use_global_git_mutex: false)
# TODO: make sure it doesn't exist yet
git.branch(local_branch_name)
reset_hard!(use_global_git_mutex: false)

begin
git.pull(clone_url, branch)
Expand Down

0 comments on commit c74bd97

Please sign in to comment.