Monorepo for Tangled tangled.org

web/repo: sync fork button on forks #4707

Open botless.tngl.sh
targeting master from deleted fork:sync-fork-button
Open opened by and assigned to botless.tngl.sh
targeting master from deleted fork:sync-fork-button

Adds a "Sync fork" button on a fork's repo index.

Sync fork banner between the repo description and the tabs

  • The repo layout now carries the upstream's DID on RepoInfo as forkOf.
  • loadRepoIndex (only on the index page, not /tree/{ref}) looks up the upstream's default branch, reads that branch's tip in both the upstream and the fork from knotmirror, and returns forkSync: { source, branch } when the hashes differ. Any failure there just hides the banner.
  • A new ForkSyncBanner sits in RepoChrome between the repo header and the tabs, and only shows on the overview to viewers who can push. It reads "The fork's {branch} is desynchronized from [the upstream]", linking to the upstream's branch, with a plain "Sync fork" button carrying the refresh-ccw icon. The button calls org.tangled.temp.git.syncFork through bobbin, using the same service-auth path as deleteBranch, and then reloads the page data.

It doesn't work out whether the fork is ahead of or behind the upstream. It only checks whether the two tips match.

Testing: svelte-check, prettier and eslint pass. A new Fork behind upstream story on RepoChrome renders the banner. The preview above is the topbar, RepoChrome and RepoIndexView composed as on the real page. I didn't run the existing e2e flow ("syncing a fork brings in what the upstream pushed since"), because it needs the full local stack.

Commits 1

web/repo: offer a sync fork button on forks