-
Notifications
You must be signed in to change notification settings - Fork 533
Isolate Dir.chdir to a new process, or mutex #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3d789f7
[WIP]Start replacing Dir.chdir with paths
3ad8851
Merge branch 'master' into 355
taquitos ba1df97
Merge branch 'master' into 355
taquitos f3f7518
fork() when using Dir.chdir, otherwise, use a mutex
f1cd6de
Merge pull request #1 from taquitos/355
taquitos df31b57
fork() when using Dir.chdir, otherwise, use a mutex
22ae609
wrap calls to in a semaphore
5449c01
Merge pull request #2 from taquitos/355
taquitos ae1baa3
Merge remote-tracking branch 'upstream/master'
e57f46f
Merge remote-tracking branch 'upstream/master'
0d32576
Revert "355"
taquitos a100a36
Merge pull request #3 from taquitos/revert-2-355
taquitos 1cdc5fd
Revert "355"
taquitos cdcc6a5
Merge pull request #4 from taquitos/revert-1-355
taquitos 0fb9798
Isolate Dir.chdir to a new process, or mutex
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ class GitExecuteError < StandardError | |
class Lib | ||
|
||
@@semaphore = Mutex.new | ||
@@config_semaphore = Mutex.new | ||
|
||
def initialize(base = nil, logger = nil) | ||
@git_dir = nil | ||
|
@@ -442,35 +441,23 @@ def config_remote(name) | |
end | ||
|
||
def config_get(name) | ||
@@config_semaphore.synchronize do | ||
do_get = lambda do |path| | ||
command('config', ['--get', name]) | ||
end | ||
|
||
if @git_dir | ||
Dir.chdir(@git_dir, &do_get) | ||
else | ||
do_get.call | ||
end | ||
do_get = lambda do |path| | ||
command('config', ['--get', name]) | ||
end | ||
|
||
do_get.call(@git_dir) | ||
end | ||
|
||
def global_config_get(name) | ||
command('config', ['--global', '--get', name], false) | ||
end | ||
|
||
def config_list | ||
@@config_semaphore.synchronize do | ||
build_list = lambda do |path| | ||
parse_config_list command_lines('config', ['--list']) | ||
end | ||
|
||
if @git_dir | ||
Dir.chdir(@git_dir, &build_list) | ||
else | ||
build_list.call | ||
end | ||
build_list = lambda do |path| | ||
parse_config_list command_lines('config', ['--list']) | ||
end | ||
|
||
build_list.call(@git_dir) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, I think we need to utilize the |
||
end | ||
|
||
def global_config_list | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 💯 this will work, but tests pass. Seems like we might need to pass the
path
to theconfig
command.