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
a78ae631
Commit
a78ae631
authored
12 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Performance fix for Pathname#prepend_prefix
See 05a456c231dc6da7cb0f7c70cb21feaf9a0d803c; same story.
parent
5e9cfec8
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/Homebrew/extend/pathname.rb
+17
-0
17 additions, 0 deletions
Library/Homebrew/extend/pathname.rb
with
17 additions
and
0 deletions
Library/Homebrew/extend/pathname.rb
+
17
−
0
View file @
a78ae631
...
...
@@ -386,6 +386,9 @@ class Pathname
end
end
# We redefine these private methods in order to add the /o modifier to
# the Regexp literals, which forces string interpolation to happen only
# once instead of each time the method is called. This is fixed in 1.9+.
if
RUBY_VERSION
<=
"1.8.7"
alias_method
:old_chop_basename
,
:chop_basename
def
chop_basename
(
path
)
...
...
@@ -397,6 +400,20 @@ class Pathname
end
end
private
:chop_basename
alias_method
:old_prepend_prefix
,
:prepend_prefix
def
prepend_prefix
(
prefix
,
relpath
)
if
relpath
.
empty?
File
.
dirname
(
prefix
)
elsif
/
#{
SEPARATOR_PAT
}
/o
=~
prefix
prefix
=
File
.
dirname
(
prefix
)
prefix
=
File
.
join
(
prefix
,
""
)
if
File
.
basename
(
prefix
+
'a'
)
!=
'a'
prefix
+
relpath
else
prefix
+
relpath
end
end
private
:prepend_prefix
end
end
...
...
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