Closed aloisklink closed 8 months ago
Optimize the validate_sha() function with --max-count=1 to prevent printing the git log of every single commit. See the "Commit Limiting" section of git-log's man page
validate_sha()
--max-count=1
git-log
This makes the function near instant.
Currently, running time git log main > /dev/null takes about ~1s second for me on the CPython repo, while time git log --max-count=1 main > /dev/null (with or without the -r flag) only takes about 0.003s.
time git log main > /dev/null
time git log --max-count=1 main > /dev/null
-r
Additionally, if you've cloned the CPython repo using a blobless clone (e.g. with git clone --filter=blob:none https://github.com/python/cpython.git), doing a git log -r takes a very long time (almost an hour for me on a slow internet connection!), since the -r flag seems to force downloading a blob for every single commit, which makes a blobless clone kind of useless.
git clone --filter=blob:none https://github.com/python/cpython.git
git log -r
Optimize the
validate_sha()
function with--max-count=1
to prevent printing the git log of every single commit. See the "Commit Limiting" section ofgit-log
's man pageThis makes the function near instant.
Currently, running
time git log main > /dev/null
takes about ~1s second for me on the CPython repo, whiletime git log --max-count=1 main > /dev/null
(with or without the-r
flag) only takes about 0.003s.Additionally, if you've cloned the CPython repo using a blobless clone (e.g. with
git clone --filter=blob:none https://github.com/python/cpython.git
), doing agit log -r
takes a very long time (almost an hour for me on a slow internet connection!), since the-r
flag seems to force downloading a blob for every single commit, which makes a blobless clone kind of useless.