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

Fix fetching git history + fallback to unshallow repo #74

Merged
merged 7 commits into from
Mar 8, 2021

Conversation

dorny
Copy link
Owner

@dorny dorny commented Mar 8, 2021

Fetching git history did not worked in all cases.
As described in #71 - either deepening the history or counting the commits didn't worked as expected.
This PR uses combination of --depth on initial fetch and later --deepen is used to extend history
Commits are now counted on all branches git rev-list --count --all.
It also increases default value of initial-fetch-depth to 100.
For most cases it should only do a single fetch.

As a last fallback try - whole history is fetched by turning shallow repo into full clone using git fetch --unshallow

closes #71

@dorny dorny merged commit 0aa1597 into master Mar 8, 2021
@dorny dorny deleted the fix-searching-for-merge-base branch March 8, 2021 16:11
micgro42 added a commit to wmde/wikit that referenced this pull request Mar 9, 2021
The latest release of the paths-filter action 2.9.1 caused a failure of
all CI update jobs. This release contained a single PR
dorny/paths-filter#74

The error message in all of our CI setup jobs was:

Run dorny/paths-filter@v2
  with:
    filters: visual:
    - 'tokens/**'
    - 'vue-components/**'
  behavioral:
    - 'vue-components/**'

    token: ***
    list-files: none
    initial-fetch-depth: 100
Changes will be detected against the branch master
Searching for merge-base master...QuantityInput
  /usr/bin/git rev-list --count --all
  640
  /usr/bin/git merge-base master QuantityInput
  fatal: Not a valid object name master
  /usr/bin/git fetch --depth=1280 origin master:master QuantityInput
  From wmde/wikit
   * [new branch]      master     -> master
   * branch            QuantityInput -> FETCH_HEAD
  /usr/bin/git rev-list --count --all
  640
  No more commits were fetched
  Last attempt will be to fetch full history
  /usr/bin/git fetch --unshallow
  fatal: --unshallow on a complete repository does not make sense
Error: The process '/usr/bin/git' failed with exit code 128
@micgro42
Copy link

micgro42 commented Mar 9, 2021

This PR caused our CI to consistently fail. Going back to 2.9.0 resolved the issue.

The error message in the logs:

Run dorny/paths-filter@v2
  with:
    filters: visual:
    - 'tokens/**'
    - 'vue-components/**'
  behavioral:
    - 'vue-components/**'

    token: ***
    list-files: none
    initial-fetch-depth: 100
Changes will be detected against the branch master
Searching for merge-base master...QuantityInput
  /usr/bin/git rev-list --count --all
  640
  /usr/bin/git merge-base master QuantityInput
  fatal: Not a valid object name master
  /usr/bin/git fetch --depth=1280 origin master:master QuantityInput
  From wmde/wikit
   * [new branch]      master     -> master
   * branch            QuantityInput -> FETCH_HEAD
  /usr/bin/git rev-list --count --all
  640
  No more commits were fetched
  Last attempt will be to fetch full history
  /usr/bin/git fetch --unshallow
  fatal: --unshallow on a complete repository does not make sense
Error: The process '/usr/bin/git' failed with exit code 128

@dorny
Copy link
Owner Author

dorny commented Mar 9, 2021

Thanks for reporting the issue. I rolled back v2 so it points to 2.9.0 until it's fixed.
It's strange that your repository is not shallow but at the same time there's no master branch.
Is there anything unusual in your workflow that could help me figuring out what happened?

@dorny
Copy link
Owner Author

dorny commented Mar 9, 2021

I think I know what happened.
You had full repository clone (actions/checkout@v2 with fetch-depth: 0 ?) but master was only a remote branch while this action did a check against local branch with that name. Following fetch didn't add any commit so it tries to unshallow repo which failed because it wasn't shallow repo. Quite unfortunate mistake on mi side.

I will fix it soon

Ladsgroup pushed a commit to wmde/wikit that referenced this pull request Mar 9, 2021
The latest release of the paths-filter action 2.9.1 caused a failure of
all CI update jobs. This release contained a single PR
dorny/paths-filter#74

The error message in all of our CI setup jobs was:

Run dorny/paths-filter@v2
  with:
    filters: visual:
    - 'tokens/**'
    - 'vue-components/**'
  behavioral:
    - 'vue-components/**'

    token: ***
    list-files: none
    initial-fetch-depth: 100
Changes will be detected against the branch master
Searching for merge-base master...QuantityInput
  /usr/bin/git rev-list --count --all
  640
  /usr/bin/git merge-base master QuantityInput
  fatal: Not a valid object name master
  /usr/bin/git fetch --depth=1280 origin master:master QuantityInput
  From wmde/wikit
   * [new branch]      master     -> master
   * branch            QuantityInput -> FETCH_HEAD
  /usr/bin/git rev-list --count --all
  640
  No more commits were fetched
  Last attempt will be to fetch full history
  /usr/bin/git fetch --unshallow
  fatal: --unshallow on a complete repository does not make sense
Error: The process '/usr/bin/git' failed with exit code 128
@dorny
Copy link
Owner Author

dorny commented Mar 9, 2021

@micgro42
I released the fix as v2.9.2 and point v2 to it.
I've already tested it on fork of your repo.

@micgro42
Copy link

Thank you for the quick fix 🙏

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.

Picking up extra files during workflow dispatch.
2 participants