crew: chdir before using git (#8859)

* chdir before using git

* bump version

* fix rubocop complaint
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2023-10-31 21:59:17 -04:00
committed by GitHub
parent 81774bc89e
commit 1cbe12f2a9
2 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# lib/const.rb
# Defines common constants used in different parts of crew
CREW_VERSION = '1.37.7'
CREW_VERSION = '1.37.8'
# kernel architecture
KERN_ARCH = `uname -m`.chomp
@@ -112,7 +112,10 @@ CREW_LOCAL_REPO_ROOT = repo_root
# The following is used in fixup.rb to determine if crew update needs to
# be run again.
CREW_CONST_GIT_COMMIT = `git log -n1 --oneline #{CREW_LIB_PATH}lib/const.rb`.chomp.split.first
Dir.chdir CREW_LIB_PATH do
@crew_const_git_commit = `git log -n1 --oneline #{CREW_LIB_PATH}lib/const.rb`.chomp.split.first
end
CREW_CONST_GIT_COMMIT = @crew_const_git_commit
CREW_LOCAL_REPO_BASE = CREW_LOCAL_REPO_ROOT.empty? ? '' : File.basename(CREW_LOCAL_REPO_ROOT)
CREW_LOCAL_MANIFEST_PATH = if ENV['CREW_LOCAL_MANIFEST_PATH'].to_s.empty?

View File

@@ -135,7 +135,9 @@ end
# Handle case of const.rb not yet defining CREW_CONST_GIT_COMMIT.
CREW_CONST_GIT_COMMIT = '0000' unless defined?(CREW_CONST_GIT_COMMIT)
@new_const_git_commit = `git log -n1 --oneline #{CREW_LIB_PATH}lib/const.rb`.chomp.split.first
Dir.chdir CREW_LIB_PATH do
@new_const_git_commit = `git log -n1 --oneline #{CREW_LIB_PATH}lib/const.rb`.chomp.split.first
end
unless @new_const_git_commit.to_s == CREW_CONST_GIT_COMMIT.to_s
puts 'Restarting crew update since there is an updated crew version.'.lightcyan