mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: make v run cmd/tools/oldv.v 5b7a1e8
-c "./v version"
faster (5b7a1e8
is the oldest supported commit from 2019-06-29)
5b7a1e8
-c "./v version"This commit is contained in:
parent
eef77e3cc1
commit
a93ef6ea67
2 changed files with 34 additions and 3 deletions
|
@ -81,8 +81,35 @@ pub fn clone_or_pull(remote_git_url string, local_worktree_path string) {
|
||||||
scripting.run('git -C "${local_worktree_path}" checkout --quiet master')
|
scripting.run('git -C "${local_worktree_path}" checkout --quiet master')
|
||||||
scripting.run('git -C "${local_worktree_path}" pull --quiet ')
|
scripting.run('git -C "${local_worktree_path}" pull --quiet ')
|
||||||
} else {
|
} else {
|
||||||
// Clone a fresh
|
// Clone a fresh local tree.
|
||||||
scripting.run('git clone --filter=blob:none --quiet "${remote_git_url}" "${local_worktree_path}" ')
|
if remote_git_url.starts_with('http') {
|
||||||
|
// cloning an https remote with --filter=blob:none is usually much less bandwidth intensive, at the
|
||||||
|
// expense of doing small network ops later when using checkouts.
|
||||||
|
scripting.run('git clone --filter=blob:none --quiet "${remote_git_url}" "${local_worktree_path}" ')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mut is_blobless_clone := false
|
||||||
|
remote_git_config_path := os.join_path(remote_git_url, '.git', 'config')
|
||||||
|
if os.is_dir(remote_git_url) && os.is_file(remote_git_config_path) {
|
||||||
|
lines := os.read_lines(remote_git_config_path) or { [] }
|
||||||
|
is_blobless_clone = lines.filter(it.contains('partialclonefilter = blob:none')).len > 0
|
||||||
|
}
|
||||||
|
if is_blobless_clone {
|
||||||
|
// Note:
|
||||||
|
// 1) cloning a *local folder* with `--filter=blob:none`, that *itself* was cloned with `--filter=blob:none`
|
||||||
|
// leads to *extremely* slow checkouts for older commits later. It takes hours instead of milliseconds, for a commit
|
||||||
|
// that is just several thousands of commits old :( .
|
||||||
|
//
|
||||||
|
// 2) Cloning it *without* the `--filter=blob:none`, leads to `error: unable to read sha1 file of`, later,
|
||||||
|
// when checking out the older commits, depending on the local git client version (tested with git version 2.41.0).
|
||||||
|
//
|
||||||
|
// 3) => instead of cloning, it is much faster, and *bug free*, to just rsync the local repo directly,
|
||||||
|
// at the expense of a little more space usage, which will make the new tree in local_worktree_path,
|
||||||
|
// exactly 1:1 the same, as the one in remote_git_url, just independent from it .
|
||||||
|
scripting.run('rsync -a "${remote_git_url}/" "${local_worktree_path}/"')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scripting.run('git clone --quiet "${remote_git_url}" "${local_worktree_path}" ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,11 @@ fn sync_cache() {
|
||||||
repofolder := os.join_path(cache_oldv_folder, reponame)
|
repofolder := os.join_path(cache_oldv_folder, reponame)
|
||||||
if !os.exists(repofolder) {
|
if !os.exists(repofolder) {
|
||||||
scripting.verbose_trace(@FN, 'cloning to ${repofolder}')
|
scripting.verbose_trace(@FN, 'cloning to ${repofolder}')
|
||||||
scripting.exec('git clone --filter=blob:none --quiet https://github.com/vlang/${reponame} ${repofolder}') or {
|
mut repo_options := ''
|
||||||
|
if reponame == 'vc' {
|
||||||
|
repo_options = '--filter=blob:none'
|
||||||
|
}
|
||||||
|
scripting.exec('git clone ${repo_options} --quiet https://github.com/vlang/${reponame} ${repofolder}') or {
|
||||||
scripting.verbose_trace(@FN, '## error during clone: ${err}')
|
scripting.verbose_trace(@FN, '## error during clone: ${err}')
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue