Skip to content

Commit ff8b676

Browse files
Fix repository checkout command sequence for specific commit
1 parent 58c776f commit ff8b676

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/ruby_wasm/build_system/product/ruby_source.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ def fetch
3535
case @params[:type]
3636
when "github"
3737
repo_url = "https://github.com/#{@params[:repo]}.git"
38-
system "git clone --depth 1 -b #{@params[:rev]} #{repo_url} #{src_dir}" or
38+
FileUtils.mkdir_p src_dir
39+
system "git init", chdir: src_dir
40+
system "git remote add origin #{repo_url}", chdir: src_dir
41+
system("git fetch --depth 1 origin #{@params[:rev]}:#{@params[:rev]}", chdir: src_dir) or
3942
raise "failed to clone #{repo_url}"
43+
system("git checkout #{@params[:rev]}", chdir: src_dir) or
44+
raise "failed to checkout #{@params[:rev]}"
4045
when "local"
4146
FileUtils.mkdir_p File.dirname(src_dir)
4247
FileUtils.cp_r @params[:src], src_dir

0 commit comments

Comments
 (0)