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 RepoSpec query extraction #4863

Merged
merged 4 commits into from Nov 14, 2022

Conversation

annasong20
Copy link
Contributor

This PR aims to fix #4849. It's also intended to be the 1st in a series of PRs to refactor the RepoSpec code, which is currently hard to read and filled with edge cases.

In addition to adding tests to cover the fix, the PR refactors some existing testing structure to make results more comprehensible.

Effectively, this PR moves query parsing to the top to avoid accidentally identifying the query as part of the host, orgRepo, or path. RFC 3986 provides support for this logic. Handling the query once and early should also make the rest of the code easier to read.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 10, 2022
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 10, 2022
@natasha41575
Copy link
Contributor

/cc @KnVerey, I think it'll be good to have your input here since you are probably the most familiar with this code out of all of us.

api/internal/git/repospec.go Show resolved Hide resolved
api/internal/git/repospec.go Outdated Show resolved Hide resolved
api/internal/git/repospec.go Show resolved Hide resolved
* Remove redundant code
* Add comment
@k8s-ci-robot
Copy link
Contributor

@annasong20: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@annasong20
Copy link
Contributor Author

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Nov 11, 2022
api/internal/git/repospec_test.go Show resolved Hide resolved
api/internal/git/repospec_test.go Show resolved Hide resolved
api/internal/git/repospec_test.go Show resolved Hide resolved
api/internal/git/repospec.go Outdated Show resolved Hide resolved
@annasong20 annasong20 changed the title Fix RepoSpec query processing Fix RepoSpec query extraction Nov 11, 2022
api/internal/git/repospec.go Outdated Show resolved Hide resolved
api/internal/git/repospec.go Outdated Show resolved Hide resolved
@KnVerey
Copy link
Contributor

KnVerey commented Nov 14, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 14, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: annasong20, KnVerey

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2022
@k8s-ci-robot k8s-ci-robot merged commit 84bd402 into kubernetes-sigs:master Nov 14, 2022
@annasong20 annasong20 deleted the fix-repospec-query branch November 14, 2022 23:06
elisshafer pushed a commit to elisshafer/kustomize that referenced this pull request Dec 8, 2022
* Clean query processing

* Improve readability

* Remove redundant code
* Add comment

* Return path literal when not parsable

* Handle url.Parse() error in future
@KnVerey KnVerey mentioned this pull request Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RepoSpec parses ref with slash as path
4 participants