-
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
Changes from 1 commit
3d789f7
3ad8851
ba1df97
f3f7518
f1cd6de
df31b57
22ae609
5449c01
ae1baa3
e57f46f
0d32576
a100a36
1cdc5fd
cdcc6a5
0fb9798
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Instead of using chdir blocks, we should use absolute paths so that we can enable threaded usage of the library Fixes #355
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,7 +310,7 @@ def branches_all | |
def list_files(ref_dir) | ||
dir = File.join(@git_dir, 'refs', ref_dir) | ||
files = [] | ||
Dir.chdir(dir) { files = Dir.glob('**/*').select { |f| File.file?(f) } } rescue nil | ||
files = Dir.glob(File.join(dir, '**/*')).select { |f| File.file?(f) } | ||
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. I wonder if the 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. Yeah, I was thinking about that too. I wasn't convinced it was needed, but it's probably safer since passing |
||
files | ||
end | ||
|
||
|
@@ -442,11 +442,7 @@ def config_get(name) | |
command('config', ['--get', name]) | ||
end | ||
|
||
if @git_dir | ||
Dir.chdir(@git_dir, &do_get) | ||
else | ||
build_list.call | ||
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. this is a typo in the original code, submitting a pr for this |
||
end | ||
do_get.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. not 💯 this will work, but tests pass. Seems like we might need to pass the |
||
end | ||
|
||
def global_config_get(name) | ||
|
@@ -458,11 +454,7 @@ def config_list | |
parse_config_list command_lines('config', ['--list']) | ||
end | ||
|
||
if @git_dir | ||
Dir.chdir(@git_dir, &build_list) | ||
else | ||
build_list.call | ||
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 | ||
|
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.
Very good fix, absolutely no reason to
chdir
in this case. 🤦♂️