Skip to content

Commit

Permalink
Merge pull request #65 from DEMON1A/master
Browse files Browse the repository at this point in the history
Add windows support for git-fastclone
  • Loading branch information
Justin Martin authored Dec 14, 2023
2 parents 04014b9 + 2f7376c commit 29e272f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ Lint/EmptyBlock:
Metrics/ClassLength:
Max: 10000

Metrics/LineLength:
Max: 110

Metrics/AbcSize:
Enabled: false

Expand Down
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ GEM

PLATFORMS
arm64-darwin-23
x64-mingw-ucrt
x86_64-linux

DEPENDENCIES
Expand All @@ -62,4 +63,4 @@ DEPENDENCIES
rubocop

BUNDLED WITH
2.4.20
2.4.22
14 changes: 12 additions & 2 deletions lib/git-fastclone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,23 @@ def reference_repo_dir(url, reference_dir, using_local_repo)
end
module_function :reference_repo_dir

def reference_filename(filename)
separator = if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
'__'
else
':'
end
"#{separator}#{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')}"
File.open(lock_file_name, File::RDWR | File::CREAT, 0o644)
end
module_function :reference_repo_lock_file
Expand Down

0 comments on commit 29e272f

Please sign in to comment.