From d91c7f1b3ba21e7ce2c83e622a88d2b66cabd738 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 4 Aug 2023 11:50:30 +0300 Subject: [PATCH] tools: use --filter=blob:none to reduce initial network trafic for most of the `git clone` commands, done by tools like oldv, gen_vc, fast_job, `v translate` etc --- cmd/tools/fast/fast_job.v | 2 +- cmd/tools/gen_vc.v | 6 +++--- cmd/tools/modules/vgit/vgit.v | 2 +- cmd/tools/oldv.v | 4 ++-- cmd/tools/performance_compare.v | 4 ++-- cmd/tools/translate.v | 2 +- cmd/tools/vls.v | 4 ++-- cmd/tools/vsetup-freetype.v | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/tools/fast/fast_job.v b/cmd/tools/fast/fast_job.v index ec31fc2d22..42cab8a74d 100644 --- a/cmd/tools/fast/fast_job.v +++ b/cmd/tools/fast/fast_job.v @@ -36,7 +36,7 @@ fn main() { if !os.exists('website') { println('cloning the website repo...') - os.system('git clone git@github.com:/vlang/website.git') + os.system('git clone --filter=blob:none git@github.com:/vlang/website.git') } for { elog('------------------- Checking for updates ... -------------------') diff --git a/cmd/tools/gen_vc.v b/cmd/tools/gen_vc.v index d568cb8317..d3ccbb579a 100644 --- a/cmd/tools/gen_vc.v +++ b/cmd/tools/gen_vc.v @@ -42,7 +42,7 @@ const ( // name app_name = 'gen_vc' // version - app_version = '0.1.2' + app_version = '0.1.3' // description app_description = "This tool regenerates V's bootstrap .c files every time the V master branch is updated." // assume something went wrong if file size less than this @@ -233,8 +233,8 @@ fn (mut gen_vc GenVC) generate() { // delete repos gen_vc.purge_repos() // clone repos - gen_vc.cmd_exec('git clone --depth 1 https://${git_repo_v} ${git_repo_dir_v}') - gen_vc.cmd_exec('git clone --depth 1 https://${git_repo_vc} ${git_repo_dir_vc}') + gen_vc.cmd_exec('git clone --filter=blob:none https://${git_repo_v} ${git_repo_dir_v}') + gen_vc.cmd_exec('git clone --filter=blob:none https://${git_repo_vc} ${git_repo_dir_vc}') // get output of git log -1 (last commit) git_log_v := gen_vc.cmd_exec('git -C ${git_repo_dir_v} log -1 --format="commit %H%nDate: %ci%nDate Unix: %ct%nSubject: %s"') git_log_vc := gen_vc.cmd_exec('git -C ${git_repo_dir_vc} log -1 --format="Commit %H%nDate: %ci%nDate Unix: %ct%nSubject: %s"') diff --git a/cmd/tools/modules/vgit/vgit.v b/cmd/tools/modules/vgit/vgit.v index 389da4851f..00603ff878 100644 --- a/cmd/tools/modules/vgit/vgit.v +++ b/cmd/tools/modules/vgit/vgit.v @@ -82,7 +82,7 @@ pub fn clone_or_pull(remote_git_url string, local_worktree_path string) { scripting.run('git -C "${local_worktree_path}" pull --quiet ') } else { // Clone a fresh - scripting.run('git clone --quiet "${remote_git_url}" "${local_worktree_path}" ') + scripting.run('git clone --filter=blob:none --quiet "${remote_git_url}" "${local_worktree_path}" ') } } diff --git a/cmd/tools/oldv.v b/cmd/tools/oldv.v index 72ac4fb866..0b6f86b019 100644 --- a/cmd/tools/oldv.v +++ b/cmd/tools/oldv.v @@ -4,7 +4,7 @@ import scripting import vgit const ( - tool_version = '0.0.3' + tool_version = '0.0.4' tool_description = ' Checkout an old V and compile it as it was on specific commit. | This tool is useful, when you want to discover when something broke. | It is also useful, when you just want to experiment with an older historic V. @@ -83,7 +83,7 @@ fn sync_cache() { repofolder := os.join_path(cache_oldv_folder, reponame) if !os.exists(repofolder) { scripting.verbose_trace(@FN, 'cloning to ${repofolder}') - scripting.exec('git clone --quiet https://github.com/vlang/${reponame} ${repofolder}') or { + scripting.exec('git clone --filter=blob:none --quiet https://github.com/vlang/${reponame} ${repofolder}') or { scripting.verbose_trace(@FN, '## error during clone: ${err}') exit(1) } diff --git a/cmd/tools/performance_compare.v b/cmd/tools/performance_compare.v index cec4f78b40..dfe432416e 100644 --- a/cmd/tools/performance_compare.v +++ b/cmd/tools/performance_compare.v @@ -4,7 +4,7 @@ import scripting import vgit const ( - tool_version = '0.0.5' + tool_version = '0.0.6' tool_description = " Compares V executable size and performance, | between 2 commits from V's local git history. | When only one commit is given, it is compared to master. @@ -39,7 +39,7 @@ fn (c Context) compare_versions() { scripting.chdir(c.vgo.workdir) scripting.run('rm -rf "${c.a}" "${c.b}" "${c.vc}" ') // clone the VC source *just once per comparison*, and reuse it: - scripting.run('git clone --quiet "${c.vgo.vc_repo_url}" "${c.vc}" ') + scripting.run('git clone --filter=blob:none --quiet "${c.vgo.vc_repo_url}" "${c.vc}" ') println('Comparing V performance of commit ${c.commit_before} (before) vs commit ${c.commit_after} (after) ...') c.prepare_v(c.b, c.commit_before) c.prepare_v(c.a, c.commit_after) diff --git a/cmd/tools/translate.v b/cmd/tools/translate.v index 99b5c81c60..1243c2cb58 100644 --- a/cmd/tools/translate.v +++ b/cmd/tools/translate.v @@ -19,7 +19,7 @@ fn main() { os.mkdir_all(vmodules)! println('C2V is not installed. Cloning C2V to ${c2v_dir} ...') os.chdir(vmodules)! - res := os.execute('git clone https://github.com/vlang/c2v') + res := os.execute('git clone --filter=blob:none https://github.com/vlang/c2v') if res.exit_code != 0 { eprintln('Failed to download C2V.') exit(1) diff --git a/cmd/tools/vls.v b/cmd/tools/vls.v index b654535bb3..8d85fd0c61 100644 --- a/cmd/tools/vls.v +++ b/cmd/tools/vls.v @@ -249,7 +249,7 @@ fn (upd VlsUpdater) compile_from_source() ! { if !os.exists(vls_src_folder) { upd.log('Cloning VLS repo...') - clone_result := os.execute('${git} clone https://github.com/vlang/vls ${vls_src_folder}') + clone_result := os.execute('${git} clone --filter=blob:none https://github.com/vlang/vls ${vls_src_folder}') if clone_result.exit_code != 0 { return error('Failed to build VLS from source. Reason: ${clone_result.output}') } @@ -483,7 +483,7 @@ fn main() { fp.application('v ls') fp.description('Installs, updates, and executes the V language server program') - fp.version('0.1') + fp.version('0.1.1') // just to make sure whenever user wants to // interact directly with the executable diff --git a/cmd/tools/vsetup-freetype.v b/cmd/tools/vsetup-freetype.v index e637498cd3..bdb93c9ce4 100644 --- a/cmd/tools/vsetup-freetype.v +++ b/cmd/tools/vsetup-freetype.v @@ -14,7 +14,7 @@ fn main() { if os.is_dir(freetype_folder) { println('Thirdparty "freetype" is already installed.') } else { - s := os.execute('git clone --depth=1 ${freetype_repo_url} ${freetype_folder}') + s := os.execute('git clone --filter=blob:none ${freetype_repo_url} ${freetype_folder}') if s.exit_code != 0 { panic(s.output) }