feat: support shallow git clones#660
Conversation
|
@ahal Can you take a look at this change? |
ahal
left a comment
There was a problem hiding this comment.
Thanks for the PR!
This looks like a good start, but the git_checkout function is internal to run-task, so there's no way for a user to request a shallow clone here. You'll need to trace backwards, forwarding the argument all the way until the main function, where you'll need to create a new command line argument for this.
It would also be much appreciated if you could update a test to cover this new flag somewhere in test/test_scripts_run_task.py :)
Oh yeah, good point—I didn’t think about that. |
ahal
left a comment
There was a problem hiding this comment.
Thanks! This is close, have a few more minor requests though.
Prevents potential backward compatibility issues.
I've addressed the comments, please review again. |
ahal
left a comment
There was a problem hiding this comment.
Apologies for the delayed review!
| parser.add_argument("--task-cwd", help="directory to run the provided command in") | ||
| parser.add_argument("--shallow", action="store_true", | ||
| default=False, help="perform a shallow clone (default: false)", | ||
| ) |
There was a problem hiding this comment.
I'm really sorry, I told you to add an argument here. But on closer look, I was wrong and instead we should add this in collect_vcs_options using an environment variable like most of the other vcs arguments. You should add something like:
shallow = os.environ.get("%s_SHALLOW_CLONE" % env_prefix)
and make sure to return it (like you already are).
|
This is being subsumed by #772 |
Support the git shallow clones using --depth=1 flag.
This PR fixes #503