Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
842862c6
Commit
842862c6
authored
8 years ago
by
Xu Cheng
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ENV/scm/git: only execute file (#493)
Fixes #491.
parent
fe391523
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/ENV/scm/git
+10
-6
10 additions, 6 deletions
Library/ENV/scm/git
with
10 additions
and
6 deletions
Library/ENV/scm/git
+
10
−
6
View file @
842862c6
...
...
@@ -19,6 +19,10 @@ SELF_REAL = Pathname.new(__FILE__).realpath
F
=
File.basename
(
__FILE__
)
.freeze
D
=
File.expand_path
(
File.dirname
(
__FILE__
))
.freeze
def executable?
(
file
)
File.file?
(
file
)
&&
File.executable?
(
file
)
end
def
exec
(
*
args
)
# prevent fork-bombs
arg0
=
args.first
...
...
@@ -35,18 +39,18 @@ when "git" then %W[HOMEBREW_GIT GIT]
when
"svn"
then
%W[HOMEBREW_SVN]
else
[]
end.each
do
|
key|
exec
ENV[key],
*
ARGV
if
ENV[key]
&&
File.
executable?
(
ENV[key]
)
exec
ENV[key],
*
ARGV
if
ENV[key]
&&
executable?
(
ENV[key]
)
end
brew_version
=
File.expand_path
(
"#{D}/../../../bin/#{F}"
)
exec
brew_version,
*
ARGV
if
File.
executable? brew_version
exec
brew_version,
*
ARGV
if
executable? brew_version
`
/usr/bin/which
-a
#{F} 2>/dev/null`.split("\n").each do |path|
exec
path,
*
ARGV unless path
==
"/usr/bin/#{F}"
end
popup_stub
=
false
if
File.
executable?
"/usr/bin/xcode-select"
if
executable?
"/usr/bin/xcode-select"
# xcode-select will return empty on no Xcode/CLT configuration.
# /usr/bin/<tool> will be a popup stub under such configuration.
# xcrun hangs if xcode-select is set to "/"
...
...
@@ -54,14 +58,14 @@ if File.executable? "/usr/bin/xcode-select"
popup_stub
=
path.empty?
if
!
popup_stub
&&
path
!=
"/"
path
=
`
/usr/bin/xcrun
-find
#{F} 2>/dev/null`.chomp
exec
path,
*
ARGV
if
File.
executable? path
exec
path,
*
ARGV
if
executable? path
end
end
path
=
"/Applications/Xcode.app/Contents/Developer/usr/bin/#{F}"
exec
path,
*
ARGV
if
File.
executable? path
exec
path,
*
ARGV
if
executable? path
path
=
"/usr/bin/#{F}"
exec
path,
*
ARGV
if
!
popup_stub
&&
File.
executable?
(
path
)
exec
path,
*
ARGV
if
!
popup_stub
&&
executable?
(
path
)
abort
"You must: brew install #{F}"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment