krew icon indicating copy to clipboard operation
krew copied to clipboard

clone single branch with depth of 1

Open slimm609 opened this issue 1 year ago • 13 comments

cloning only the default branch and with a depth of 1 speeds up the clone time greatly

I0818 19:01:24.786890   27900 git.go:79] Going to run git clone --depth=1 --single-branch -v [email protected]:test/test.git /Users/dbrian/.krew/index/test
Cloning into '/Users/dbrian/.krew/index/test'...
I0818 19:01:25.342370   27900 fetch_tag.go:47] Parsing response from GitHub
I0818 19:00:39.064036   27722 git.go:79] Going to run git clone -v [email protected]:test/test.git /Users/dbrian/.krew/index/test
Cloning into '/Users/dbrian/.krew/index/test'...
I0818 19:00:48.527775   27722 root.go:180] Upgrade check was skipped or has not finished

Fixes #403

slimm609 avatar Aug 18 '23 23:08 slimm609

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: slimm609 Once this PR has been reviewed and has the lgtm label, please assign chriskim06 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Aug 18 '23 23:08 k8s-ci-robot

Welcome @slimm609!

It looks like this is your first PR to kubernetes-sigs/krew 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/krew has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Aug 18 '23 23:08 k8s-ci-robot

/assign @ahmetb

slimm609 avatar Oct 27 '23 11:10 slimm609

/assign @Jaanki

slimm609 avatar Jan 20 '24 23:01 slimm609

@slimm609: GitHub didn't allow me to assign the following users: Jaanki.

Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide

In response to this:

/assign @Jaanki

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 20 '24 23:01 k8s-ci-robot

I will try to take a look at this sometime but any mistake here can brick Krew installations forever, and our commit history is not particularly bloated so it's not top priority right now. Let me know if there's a particular reason you're pushing for it.

ahmetb avatar Jan 20 '24 23:01 ahmetb

thanks @ahmetb. With larger private repos for plugins, it can take a very long time to install or update because it downloads the entire history of the repo just to install and all branch references just to install from the main branch. This changes to only download the most recent commit (no history) and only the repo's main branch instead of the main branch plus all additional branches.

slimm609 avatar Jan 20 '24 23:01 slimm609

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 20 '24 00:04 k8s-triage-robot

/remove-lifecycle stale

slimm609 avatar Apr 22 '24 11:04 slimm609

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 21 '24 11:07 k8s-triage-robot

/remove-lifecycle stale

slimm609 avatar Jul 21 '24 12:07 slimm609

Sorry for the delay here. I have a follow up question: doesn't the subsequent "git fetch origin && git reset -hard @{upstream}" command re-download the repository anyway?

If that's the case, I don't think this optimization is worth doing (and may end up being worse) for long-term installations that install/update plugins on the same machine over time.

ahmetb avatar Jul 23 '24 04:07 ahmetb

Sorry for the delay here. I have a follow up question: doesn't the subsequent "git fetch origin && git reset -hard @{upstream}" command re-download the repository anyway?

If that's the case, I don't think this optimization is worth doing (and may end up being worse) for long-term installations that install/update plugins on the same machine over time.

git reset --hard @{upstream} will just reset but git fetch -v can be updated to git fetch -v origin HEAD to only apply to the that branch

slimm609 avatar Aug 08 '24 11:08 slimm609