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

Skip to content

chore: fix regex bug in migration number fixer#16822

Merged
dannykopping merged 1 commit into
mainfrom
dk/migration-merge
Mar 6, 2025
Merged

chore: fix regex bug in migration number fixer#16822
dannykopping merged 1 commit into
mainfrom
dk/migration-merge

Conversation

@dannykopping

@dannykopping dannykopping commented Mar 6, 2025

Copy link
Copy Markdown
Contributor

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.

Comment thread .github/workflows/ci.yaml Outdated
@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

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

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
@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