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 hash render end with colon #31319

Merged
merged 2 commits into from
Jun 12, 2024
Merged

Conversation

lunny
Copy link
Member

@lunny lunny commented Jun 11, 2024

Fix a hash render problem like <hash>: xxxxx which is usually used in release notes.

@lunny lunny added type/bug backport/v1.22 This PR should be backported to Gitea 1.22 labels Jun 11, 2024
@lunny lunny requested a review from appleboy June 11, 2024 08:58
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 11, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 11, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jun 11, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 11, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 11, 2024
@@ -49,7 +49,7 @@ var (
// hashCurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae
// Although SHA1 hashes are 40 chars long, SHA256 are 64, the regex matches the hash from 7 to 64 chars in length
// so that abbreviated hash links can be used as well. This matches git and GitHub usability.
hashCurrentPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-f]{7,64})(?:\s|$|\)|\]|[.,](\s|$))`)
hashCurrentPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-f]{7,64})(?:\s|$|\)|\]|[.,:](\s|$))`)
Copy link
Member

Choose a reason for hiding this comment

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

By the way, why aren't we using \b here?
I think that would simplify things…

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like yes. Maybe I should change to \b?

Copy link
Member

Choose a reason for hiding this comment

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

Try it and see if the existing test cases work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe it can be tried by another PR since this one is a quick patch.

Copy link
Member

Choose a reason for hiding this comment

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

Ok

@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 12, 2024
@silverwind silverwind enabled auto-merge (squash) June 12, 2024 22:07
@silverwind silverwind merged commit 7115dce into go-gitea:main Jun 12, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Jun 12, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Jun 12, 2024
Fix a hash render problem like `<hash>: xxxxx` which is usually used in
release notes.
@GiteaBot GiteaBot added backport/done All backports for this PR have been created and removed reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels Jun 12, 2024
@lunny lunny deleted the lunny/fix_hash_colon branch June 13, 2024 00:46
lunny added a commit that referenced this pull request Jun 13, 2024
Backport #31319 by @lunny

Fix a hash render problem like `<hash>: xxxxx` which is usually used in
release notes.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 13, 2024
* giteaofficial/main:
  Fixed incorrect localization `explorer.go` (go-gitea#31348)
  Improve detecting empty files (go-gitea#31332)
  Fix hash render end with colon (go-gitea#31319)
  Fix line number widths (go-gitea#31341)
  Fix navbar `+` menu flashing on page load (go-gitea#31281)
  Reduce memory usage for chunked artifact uploads to MinIO (go-gitea#31325)
  Fix dates displaying in a wrong manner when we're close to the end of the month (go-gitea#31331)
  Fix adopt repository has empty object name in database (go-gitea#31333)
  Optimize profile layout to enhance visual experience (go-gitea#31278)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created backport/v1.22 This PR should be backported to Gitea 1.22 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants