Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: fix regex bug in migration number fixer #16822

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

Merged
merged 1 commit into from
Mar 6, 2025
Merged

Conversation

dannykopping
Copy link
Contributor

@dannykopping dannykopping commented Mar 6, 2025

This fixes a slight regex bug on Bash 5, where [:/] would only match : but not both :/.

$ git remote -v | grep "github.com[:/]coder/coder.*(fetch)" | cut -f1

$ git remote -v | grep "github.com[:/]*coder/coder.*(fetch)" | cut -f1
origin

The former will actually cause the whole script to bork because of pipefail, since grep exits 1.

@dannykopping dannykopping marked this pull request as draft March 6, 2025 07:01
@dannykopping dannykopping force-pushed the dk/migration-merge branch 2 times, most recently from fcb516a to 1208852 Compare March 6, 2025 07:03
@dannykopping dannykopping marked this pull request as ready for review March 6, 2025 07:06
@dannykopping dannykopping changed the title chore: prevent duplicate migration numbers in main chore: fix regex bug in migration number fixer Mar 6, 2025
@dannykopping dannykopping requested a review from mafredri March 6, 2025 07:24
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

I checked both the grep on macOS (2.6.0-FreeBSD) as well as GNU grep (3.11) and I can't figure out why this would produce different results on any version of grep. The only difference I see here is that we now allow :: and //, etc.

Or are you suggesting that a remote may be named github.com:/coder/coder and you wanted to add support for that? Edit: I re-read your description and that was indeed what you were going for. I thought ^this is an illegal format on GitHub but if not, have at it 👍🏻

Approving to unblock though since it's not a harmful change.

@dannykopping dannykopping merged commit b16275b into main Mar 6, 2025
32 checks passed
@dannykopping dannykopping deleted the dk/migration-merge branch March 6, 2025 10:21
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants