-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 some mirror bugs #18649
Fix some mirror bugs #18649
Conversation
89c748c
to
a7309af
Compare
8391deb
to
e04309a
Compare
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.
LGTM (maybe some consts can be used for extraMark)
return nil, err | ||
} | ||
return &GitURL{URL: u}, nil | ||
} else if strings.Contains(remote, "@") && strings.Contains(remote, ":") { |
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.
The SCP target path parsing is found here: https://github.com/openssh/openssh-portable/blob/16ea8b85838dd7a4dbeba4e51ac4f43fd68b1e5b/misc.c#L767-L834
- If there is a
'['
then we can split by the first':'
after']'
- note this
':'
has to be immediately after the]
otherwise the whole parse fails and it's a path.
- note this
- Otherwise split by the first
':'
- We split by this
':'
into<host_user> ':' <path>
- if
<path>
is empty set to"."
. If no':'
set all to<path>
- if
- Split
<host_user>
by'@'
into<user> '@' <host-to-clean>
.- if no
'@'
set all to<host-to-clean>
- if no
<host-to-clean>
- strip off'['
and']'
if present to form the<host>
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.
Although the scp url parsing isn't exactly the same as that in ssh it appears almost equivalent.
make L-G-T-M work |
Removed backport because the changes too big to cherry pick. |
* giteaoffical/main: Fix signal loop in graceful manager (go-gitea#19943) Prettify number of issues (go-gitea#17760) Improve file header on mobile (go-gitea#19945) Unify repo settings & show better error (go-gitea#19828) [skip ci] Updated translations via Crowdin fixed comment typo (go-gitea#19944) Auto merge pull requests when all checks succeeded via WebUI (go-gitea#19648) Fix some mirror bugs (go-gitea#18649)
if !m.IsMirror { | ||
return a | ||
} |
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.
@lunny I saw an issue here, the push mirrors URL are no longer displayed on the UI
I think we should return empty remoteAddress when the repo is a mirror not the opposite
if m.IsMirror {
return a
}
* Fix some mirror bugs * Remove unnecessary code * Fix lint * rename stdard url * Allow more charactors in git ssh protocol url * improve the detection * support ipv6 for git url parse * Fix bug * Fix template * Fix bug * fix template * Fix tmpl * Fix tmpl * Fix parse ssh with interface * Rename functions name Co-authored-by: zeripath <art27@cantab.net>
This PR introduces a new git URL parse package to parse git URL.
It will fix mirror repository UI display problem.
Fix #18652