Skip to content
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

Add windows support for git-fastclone #65

Merged
merged 5 commits into from
Dec 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add windows support for git-fastclone
Created a new function for the path generation that validates the current operation system before generating the path, and uses underscore in-case a windows system is being used to make sure git-fastclone doesn't use a non-allowed characters for windows filenames that prevents the submodules and lock files from being created
DEMON1A authored Dec 9, 2023

Verified

This commit was signed with the committer’s verified signature.
commit 4d57de6f4364869b79eb53bc074cfe945c313504
14 changes: 12 additions & 2 deletions lib/git-fastclone.rb
Original file line number Diff line number Diff line change
@@ -47,13 +47,23 @@ def reference_repo_dir(url, reference_dir, using_local_repo)
end
module_function :reference_repo_dir

def reference_filename(filename)
portation_character = if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
'_'
else
':'
end
"#{portation_character}#{filename}"
end
module_function :reference_filename

def reference_repo_submodule_file(url, reference_dir, using_local_repo)
"#{reference_repo_dir(url, reference_dir, using_local_repo)}:submodules.txt"
"#{reference_repo_dir(url, reference_dir, using_local_repo)}#{reference_filename('submodules.txt')}"
end
module_function :reference_repo_submodule_file

def reference_repo_lock_file(url, reference_dir, using_local_repo)
lock_file_name = "#{reference_repo_dir(url, reference_dir, using_local_repo)}:lock"
lock_file_name = "#{reference_repo_dir(url, reference_dir, using_local_repo)}#{reference_filename('lock')}" # rubocop:disable Layout/LineLength
File.open(lock_file_name, File::RDWR | File::CREAT, 0o644)
end
module_function :reference_repo_lock_file