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

Lack of commit history can cause failures when switching context from 'repo' to 'branch' #324

Open
electrofelix opened this issue Sep 11, 2024 · 0 comments

Comments

@electrofelix
Copy link

The current action defaults to recommending that callers ensure that the repo clone has it's full history with depth: 0 set as a option to the actions/checkout github action.

For large repos this can result in a noticeable slowdown as well as sometimes it can be easy for people to miss the requirement.

The action could add a small check when fetching tags to control whether to fetch commit history at the same time in order to allow for a more reliable check though maybe it would be better to add an option to allow users to explicitly opt in to doing this:

isShallow=$(git rev-parse --is-shallow-repository)
if [[ "${isShallow}" == "true" ]]; then
    git fetch --unshallow --filter=tree:0 --refetch origin --tags
else
    git fetch --tags
fi

This can be handy where people are using this action as part of another where they may not be controlling the initial clone. Instead of needing to make sure full history they can unshallow a clone to just get the commit history without downloading all the blobs. This also helps keep the action behaviour quick for larger repos.

@electrofelix electrofelix changed the title Auto unshallow clones using treeless filter Lack of commit history can cause failures when switching context from 'repo' to 'branch' Sep 11, 2024
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

No branches or pull requests

1 participant