-
Notifications
You must be signed in to change notification settings - Fork 128
repo: remotes family: implement list/get-url/set-url #67
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
Conversation
Because of
It'd make sense to use RemotesList instead of ListRemotes; the same with RemoteURLGet and RemoteURLSet (used here) vs GetRemoteURL and SetRemoteURL (style in file). Are style for func names enforced? I didn't follow the exact naming in the same file. |
force-pushes:
|
also added utils: stdoutToStringSlice()
@unknwon PTAL, planning to do similar PRs for additional commands. |
No there is no existing enforced naming convention, but I think your idea of being closer to how a user would use Git bin makes total sense 👍 |
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.
Thanks for the PR! Overall looking good 🤩 Mostly convention issues.
repo_remote.go
Outdated
// RepoRemoteURLSetFirst sets first URL of the remote with given name of the repository in given path. | ||
func RepoRemoteURLSetFirst(repoPath, name, newurl string, opts ...RemoteURLSetOptions) error { |
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.
How is the "first" come into play? Not seeing "first" is used as git args?
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.
uhh yeah so.. repo can have like
origin urls:
- type fetch url: foobar1
- type push url: foobar2
- type fetch url: foobar3
- type fetch url: foobar4
^^^ in this case, the first fetch url is foobar1, and first push url is foobar3
In reality, this almost never happens, and even if it does, the 'first' is used elsewhere as well.
It might be a good idea to add a short 'it is almost always first, and if not, you probably don't have to worry', but don't know on how to word it.
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.
Thanks for the context!
Either way I think we do not need explicitly put "first" in our function name because we are basically pass-on the value from Git CLI, and whatever it returns is what we return to the caller.
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.
Sorry about delayed response 😅
repo_remote.go
Outdated
// RepoRemoteURLSetFirst sets first URL of the remote with given name of the repository in given path. | ||
func RepoRemoteURLSetFirst(repoPath, name, newurl string, opts ...RemoteURLSetOptions) error { |
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.
Thanks for the context!
Either way I think we do not need explicitly put "first" in our function name because we are basically pass-on the value from Git CLI, and whatever it returns is what we return to the caller.
I can't see how, but I improved the wording nevertheless. edit:
fixed
s/SetFirst/Set/g done
s/URLGet/GetURL/g, s/URLSet/SetURL/g also jfyi you can make direct edits in the PR as you see fit |
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.
Thanks again for the follow up!
I made a push in 1e5f3c2, LMK if you have any questions, otherwise I'm going to merge once looks good to you! |
RemoteSetURLDelete seems odd for me, RemoteDeleteURL is better imo (even though it does not exactly follow git-bin)? |
suggested refactor out of this PR: type RemotesOptions struct {
// The timeout duration before giving up for each shell command execution.
// The default timeout duration will be used when not supplied.
Timeout time.Duration
} You can just do type DefaultOptions struct {
// The timeout duration before giving up for each shell command execution.
// The default timeout duration will be used when not supplied.
Timeout time.Duration
}
// and for each:
var RemotesOptions DefaultOptions |
// and for each:
var RemotesOptions DefaultOptions How will |
It will be the same to the user, if anything is added later, you can change it from DefaultOptions to something different. Using
yes, oops |
Yeah, SGTM! Let's do this in another PR. As for this PR, I think once we bring back the |
See #67 (comment) Either adding the comment, or actually doing static checking would be nice. |
okie then |
LGTM @unknwon |
Let's wait for the CI! |
https://github.com/gogs/git-module/releases/tag/v1.2.0 has been tagged for this merge. |
edit: ready to review