cloud-run-button icon indicating copy to clipboard operation
cloud-run-button copied to clipboard

redirector: Handing of slashes in branch names seems incorrect

Open ahmetb opened this issue 5 years ago • 2 comments

I have just tried deploying from URL:

https://github.com/ahmetb/golang-samples/tree/run/grpc-server-streaming/run/grpc-server-streaming

where the branch name was run/grpc-server-streaming.

funny enough, there's no way for redirector to tell whether it is

branch = run
dir = grpc-server-streaming/run/grpc-server-streaming

or

branch = run/grpc-server-streaming
dir =run/grpc-server-streaming

So it naturally did some regex matching and wrongly assumed branch=run, despite specifying ?dir= correctly.

cloudshell_open --repo_url "https://github.com/ahmetb/golang-samples.git" --dir "run/grpc-server-streaming" --page "editor" --git_branch "run"
[ ✓ ] Cloned git repository https://github.com/ahmetb/golang-samples.git.
Error: failed to checkout revision "run": git checkout failed: exit status 1, output:
error: pathspec 'run' did not match any file(s) known to git.

I don't think we can reliably disambiguate the URL in this case. (GitHub probably does, because it has the data.) Just wanted to note.

ahmetb avatar Jan 16 '20 21:01 ahmetb

Oh bummer. We could put a note in the docs indicating that branches containing a / aren't supported by the redirector.

jamesward avatar Jan 16 '20 22:01 jamesward

I am thinking it's not worth making docs longer, especially ?revision and ?dir overrides are documented.

ahmetb avatar Jan 16 '20 22:01 ahmetb