Skip to content
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

Add ability to use filter arguments #19

Merged
merged 4 commits into from
Nov 3, 2022

Conversation

BojanZelic
Copy link
Contributor

This is useful if you have a large mono repo, with a massive history & don't want to clone down all objects;

allows you to pass in --filter=blob:none to the command to reduce the amount of objects git would try to fetch;

@SnowCait
Copy link
Member

That is nice!
I'll merge after review.

Please ignore CI failure of Assign / assign and Test / local (windows-2016).

@SnowCait SnowCait self-assigned this Oct 18, 2022
Copy link
Member

@SnowCait SnowCait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Could you please just fix docs?

Comment on lines +122 to +127
FILTER_ARG="--no-filter"
if [ -n "$FILTER" ]; then
FILTER_ARG="--filter=$FILTER"
fi

$GIT -c protocol.version=2 fetch --no-tags --prune --progress "$FILTER_ARG" --depth=1 origin +${REF}:refs/remotes/origin/${REF}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE

I couldn't find the --filter / --no-filter options in git fetch command, but it seems to be available as same as git clone command.
https://stackoverflow.com/questions/68084224/can-you-apply-a-filter-to-git-fetch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git fetch --filter=blob:none sets config below in fact.

[remote "origin"]
        url = https://github.com/snow-actions/sparse-checkout.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        promisor = true
        partialclonefilter = blob:none

git fetch --no-filter is

[remote "origin"]
        url = https://github.com/snow-actions/sparse-checkout.git
        fetch = +refs/heads/*:refs/remotes/origin/*

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@SnowCait SnowCait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could commit :)

Thank you for PR!

@SnowCait SnowCait merged commit db7ad18 into snow-actions:main Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants