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

Reading from arbitrary refs through proxy #1154

Open
tazjin opened this issue Feb 28, 2023 · 3 comments
Open

Reading from arbitrary refs through proxy #1154

tazjin opened this issue Feb 28, 2023 · 3 comments

Comments

@tazjin
Copy link
Contributor

tazjin commented Feb 28, 2023

It would be quite useful to be able to read and filter arbitrary refs through josh-proxy. For example, Gerrit changes become available with refs like refs/changes/96/8096/21 and at TVL we have revision numbers at refs like refs/r/1337.

This would make it possible to expand ref-based versioning schemes (in our case, monotonically increasing integers) to filtered views and workspaces, or filter in-progress changes for test flows.

If this is in fact already possible, then consider the issue to be about documenting what syntax allows it :)

I've looked into this a little bit but am not familiar enough with the codebase to find the right spot to look. f1c8188 pointed me towards the apply_view_to_branch function, but that has since been refactored to elsewhere and I haven't found it yet

@christian-schilling
Copy link
Member

christian-schilling commented Feb 28, 2023

This is a pretty common, already covered use case:
You can use an URL like https://server/repo.git@refs/r/1337:filter.git
Instead of @ you can use ^ (useful in some contexts) and instead of a ref you can also use a sha (of the canonical history) to specify what revision to filter.
See https://github.com/josh-project/josh/blob/master/tests/proxy/clone_sha.t

The resulting repo will have HEAD pointing to the filtered version of the specified rev.

@tazjin
Copy link
Contributor Author

tazjin commented Feb 28, 2023

Thanks, that seems to work fine with the Gerrit change refs (which are the most important!). I'll see if I can come up with a docs change to make that easier to find.

However, I can't get that to work with our refs/r/... refs. We're currently working on upgrading our josh from a one year old version (time flies ...) to the current HEAD, and I'm actually seeing different behaviour on the two versions. The old one seems to ignore the refs/r/$n and just clones HEAD, the new one clones an empty repository.

Will spend more time investigating that later, for now I'm focusing on a different issue.

@deliciouslytyped
Copy link

I ran into not finding documentation on this, though I eventually found this issue.
I also ran into a problem of cloning empty repositories, but this is unrelated. I was trying to do the following, and the issue was the leading slash in the file path:
git clone http://localhost:4002/owner/project.git@refs/heads/develop::/infra/containers/DEPLOYMENT.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants