-
Notifications
You must be signed in to change notification settings - Fork 805
[Benchmarks] Add option for shallow clones #20137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: sycl
Are you sure you want to change the base?
Conversation
a7e06f4
to
bfa0487
Compare
name: str, | ||
force_rebuild: bool = False, | ||
no_suffix_src: bool = False, | ||
shallow_clone: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't this be the default? I think we only need the exact commit/tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a clean way for updating a shallow repo with all kinds of refs (tag, branch, sha). For such repos the way to switch to other commit is to make a clean shallow copy of repo. Most of repositories we use are small enough so we could have some (maybe rare, but still) gains from having a full copy, ie. when debugging an older tag/commit.
On the other hand, having by default a clean shallow copy each time a ref can't be found would ensure that we have a clean state without having to call git --reset
or git checkout
. It's just that we will have to fetch more data more often.
I'll make a shallow copy a default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
log.debug(f"Cloning {self._url} into {self.src_dir} at commit {self._ref}") | ||
git_clone_cmd = "git clone --recursive" | ||
if self._shallow_clone: | ||
git_clone_cmd += f" --depth 1 --branch {self._ref}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't work for commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Checking if ref
is either a branch or a tag, if not, fallback to a full clone.
bfa0487
to
87a6bf7
Compare
To speed up cloning big repositories, add an option for a shallow clone.
To speed up cloning big repositories, add an option for a shallow clone.