13rac1 / block-fixup-merge-action

Github Action to block merge of Pull Requests containing fixup! or squash! commits
MIT License
46 stars 14 forks source link

What is `__ci_base` and `__ci_pr`? #23

Closed samholmes closed 3 years ago

samholmes commented 3 years ago

When looking at the entrypoint.sh source, I noticed refspecs containing __ci_base and __ci_pr (https://github.com/13rac1/block-fixup-merge-action/blob/master/entrypoint.sh#L26), but I cannot find any documentation on these tags (I assume they're tags). I'm noticing issues where the git log __ci_base..__ci_pr command is returning a list of commits farther back than the base ref.

samholmes commented 3 years ago

To answer my own question, these branches are created on lines 18 and 19 (https://github.com/13rac1/block-fixup-merge-action/blob/master/entrypoint.sh#L18).

13rac1 commented 3 years ago

Can this be closed? Seems like it. 😉

samholmes commented 3 years ago

Sure, this can be closed. Though I resolved a problem that was in my fork of this project: https://github.com/samholmes/block-wip-pr-action/pull/2 Perhaps it’s relevant here as well. The problem was that if the base branch was ahead of the PRs merge base, then the depth wouldn’t be large enough to get to the merge base, and the fetch for the PR branch would go to init. If there are any fixup/squash commits in the trunk (accidental commits prior to adding the action to protect), then the action would fail.

13rac1 commented 3 years ago

Ah interesting, that is a problem. Oh edge cases...

Increasing the depth to 500 as you've done will (can?) result in significantly more data transfer on some repositories and therefore longer run times:

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=500 origin "${BASE_REF}:__ci_base"

This solution works, but I wonder if there's a more efficient process? 🤔

samholmes commented 3 years ago

Start with a lower depth and increase it until git merge-base __ci_pr __ci_base is not a merge commit? Just idea I haven’t tried yet.

On Sun, Jul 11, 2021 at 12:51 PM Brad Erickson @.***> wrote:

Ah interesting, that is a problem. Oh edge cases...

Increasing the depth to 500 as you've done will (can?) result in significantly more data transfer on some repositories and therefore longer run times:

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=500 origin "${BASE_REF}:__ci_base"

This solution works, but I wonder if there's a more efficient process? 🤔

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/13rac1/block-fixup-merge-action/issues/23#issuecomment-877851729, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD6KXN2LU2HDEFAPSQTGKDTXHY27ANCNFSM475IKBEA .