-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add config for default branch name #171
Conversation
What about adding a config variable to define the default branch name ? Like Gitea with |
Good idea! Will update |
Added new config: |
internal/config/config.go
Outdated
branchRe := regexp.MustCompile("^[a-z0-9-_]+$") | ||
if !branchRe.MatchString(c.GitDefaultBranch) { | ||
return fmt.Errorf("invalid git default branch name: %s", c.GitDefaultBranch) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea but it kind of restrict allowed branch names with slashs or dots.
Of course almost everyone would use master
or main
so it's not a big deal at all, but it seems weird to me to restrict valid branches names from Git if there is a restriction in the first place.
Maybe we could remove this restriction or use a more (much) complicated regex ?
For reference : https://git-scm.com/docs/git-check-ref-format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to prefer having input validation, but I suppose it would throw errors if an invalid branch name is specified, so removing this is probably fine.
Whoops I just realized that I did not publish the review earlier.. my bad. Anyway what do you think ? |
LGTM |
Co-authored-by: Thomas Miceli <[email protected]>
Co-authored-by: Thomas Miceli <[email protected]>
Hi! First, thanks so much for this awesome project, it's exactly what I was looking for :)
Using
main
as the default branch is more common now days, so I thought I would change it here.Testing:
main