-
Notifications
You must be signed in to change notification settings - Fork 67
Description
I started to document my workflow as promissed in #1417. However I also wanted to document how one could use josh-proxy to fetch a workspace branch into an existing monorepo clone.
Is this possible? I understand that the josh proxy parses the HTTP request line to find the requested filter after the colon. However in an existing clone I'd like to just use the origin remote and somehow still get the filter through to the josh proxy.
After the fetch I'd then use git worktree on the FETCH_HEAD.
It seems, filters can only be specified as part of a clone url, since the code searches for the filter in a "FilteredRefRegex" struct. So this issue is probably a feature request to also support specifying filters through a server-option, e.g.:
git fetch --server-option=josh-filter=... origin
For reference, a full example workflow:
URL=https://code.tvl.fyi/depot.git
git clone --bare $URL monorepo
# --depth=1 leads to divergence from the monorepo
# --filter=blob:non is not supported by gerrit and gives: "warning: filtering not recognized by server, ignoring"
cd monorepo
# initial setup of the monorepo clone
ln -s ~/bin/gerrit-commit-msg-hook hooks/commit-msg
git config set --local url.$URL.insteadOf josh
git config set --local remote.origin.pushurl ssh://[email protected]:29418/depot
git config set --local remote.origin.push canon:refs/for/canon # since tvl uses gerrit
# create a git worktree
git fetch josh:/web/planet-mars.git
git worktree add -b planet-mars ../planet-mars FETCH_HEAD
cd ../planet-mars
cargo update # do some edits...
git commit #...
josh-filter ":/web/planet-mars" refs/heads/canon --update refs/heads/planet-mars --reverse
git log -1 --stat canon
git push