New Repl link from git, with a branch specified

There seems to be no way to specify a branch to clone, or a sub directory to use.

Branch cloning is critical for replicating PR’s. That would give any reviewer a clean, exact, up-to-date, editable, safe copy of the PR in question… which can’t be done with Replit at the moment.

Example:
Works: https://replit.com/new/github/FossPrime/feathers-chat works,
Doesn’t: https://replit.com/new/github/FossPrime/feathers-chat/tree/replit-debugger

Thank you

1 Like

Yeah it thinks that when you are cloning a branch, it’s a private repo.

3 Likes

The branch isn’t a git repository, so you can’t clone it. Maybe download a .tar.gz for the repo, move the part you want out of the downloaded files, delete the original part, and then move the part you wanted into the base directory for the repl.

2 Likes

It is a git repository… it’s Github page is here GitHub - FossPrime/feathers-chat at replit-debugger

Is there a way make a New Replit link from https://github.com/FossPrime/feathers-chat/archive/refs/heads/replit-debugger.zip ?

Something like replit.com/new/github.com/FossPrime/feathers-chat/archive/refs/heads/replit-debugger.zip ?

1 Like

I’ll try to create a repl that does that when forked

1 Like

Can’t you just clone the master branch and once it’s cloned go to the shell and run git checkout x or gh pr checkout x?

1 Like

Indeed… the issue with that is that I’ll have my own container, with it’s own stateful configuration and side effects. A PR link should be an exact stateless reproduction of the modifications made, without having to ask the maintainers to figure it out themselves. Not only that, they can’t really try properly without privileged access I would have to give them… if git is used, that’s not secure to do with strangers.

Here is an example from StackBlitz, they not only support cloning your branches, but even subfolders within them:
https://stackblitz.com/fork/github/feathersjs/playground/tree/FossPrime/patch-koa/starter

From: playground/starter at FossPrime/patch-koa · feathersjs/playground · GitHub

That gives any reviewer a clean, exact, up-to-date, editable, safe copy of the PR in question… which can’t be done with Replit at the moment.
Git repo:

1 Like

I agree, It would be really nice to have multiple clones of a previous branch for testing.

2 Likes

StackBlitz doesn’t actually use git afaik, so they’re probably unrelated.

1 Like

StackBlitz Classic uses a worker to pull the contents from git, similar to Replit.
Their new VS Code based version, CloudFlow, clones from git exclusively, and has a browser based git with a CORS proxy… it’s trippy, but inherently hamstrung by browser security GitHub - FossPrime/fsh: Created with StackBlitz ⚡️

StackBlitz’s CloudFlow JS on-device terminal:

1 Like

They they’re probably just running git switch <branch> at the end. Will that work if you try it?

1 Like

If manually run by the PR reviewer that does work… but there’s no way to pass that command to post-onBoot or onBoot. Speaking of which StackBlitz also has a way to pass commands to npm run from a link. It’s secured by not allowing for arguments, slow performance and the inherent whitelist of allowed commands in package.json.

https://stackblitz.com/edit/vitejs-vite-itctul?file=package.json&terminal=m,y,%20,s,e,c,r,e,t,%20,m,e,s,s,a,g,e,dev

Ideally, in Replit such a feature should be limited to links for NEW containers. That way there is no risk of leaking secrets.

1 Like

Replit doesn’t run commands locally (and stackblitz doesn’t even actually use npm), so they’re completely different from each other.

1 Like

I’ve implemented and deployed this feature to vslite.dev…

Copy my code if you want!

https://vslite.dev/~/gh/kat-tax/vslite.git

code behind the git branch and PR-diff cloning feature: test/index.ts · main · vBlip / Git for Cloud · GitLab

3 Likes