Files
skillshare/website/docs
Willie dd6991ca3c fix(push): refuse unpushed config.yaml history at root scope (#366) (#372)
* fix(push): reject unpushed config history at root scope

Untracking config.yaml at the tip still uploads its contents from earlier local commits. Refuse root-scope pushes before mutation and before upload when unpublished history adds or changes the file or its directory tree, without rewriting history.

Share the check across the CLI and dashboard, return unpushed_config_history, and allow removals and config inherited unchanged from upstream merges. Cover first pushes, dry runs, push --pull, directory paths, renames, and merge commits, and document manual repair in all website locales.

Fixes #366

* fix(push): check exactly what push sends for config history

Review of the config history guard found two range problems:

- The guard checked @{u}..HEAD, but a same-named upstream was pushed with
  a bare `git push`. With remote.pushDefault or push.default=matching that
  could send config-bearing commits to another remote, or other branches,
  that the guard never looked at. PushArgs now always names the upstream
  remote and branch (read from branch config, so names with "/" survive),
  so the checked range and the pushed range are the same.
- Without an upstream every commit on HEAD counted as unpushed, so a
  config.yaml already published on origin followed by the
  "Keep config.yaml out of version control" commit was refused. The guard
  now checks HEAD --not --remotes=<push remote>.

The refusal message now suggests rebasing from just before the oldest
offending commit instead of @{u} or --root, which would rewrite commits
the remote already has.

* fix(push): check config history against the remote's live refs

Local remote-tracking refs can be stale. When another machine force-pushes
the remote to drop a leaked config.yaml commit, this clone's
refs/remotes/<remote>/... still contains it, so the guard treated the leak
as already published and HEAD:main, still a fast-forward, would publish it
again.

The guard now excludes only the objects the push remote's refs point to
right now (git ls-remote), limited to objects this clone has. It falls back
to local remote-tracking refs only when the remote cannot be reached, in
which case the push fails anyway. Revisions go to git log on stdin as
"^<id>" lines because git before 2.42 rejects "--not" there.

* fix(push): screen config history against every push URL, without replace refs

Two more ways the screened history could differ from what git push uploads:

- `git ls-remote <remote>` queries the fetch URL, but git push sends to every
  remote.<name>.pushurl. A commit already on the fetch URL could still be
  new to a push URL. The guard now lists `git remote get-url --push --all`
  and excludes only objects that every push URL has.
- With a refs/replace/* entry for an offending commit, git log read the
  sanitized replacement while the push pack carries the original. The log
  and the rebase-base lookup now run with --no-replace-objects.

* fix(push): let pushes the remote will reject reach the pull step

Our own review of the config history guard found two problems:

- When another machine had pushed, the remote's tip was unknown locally, so
  no live ref survived the "objects this clone has" filter and the whole
  history counted as unpushed. A config.yaml published long ago, followed by
  the stop-tracking commit, then blocked `push --pull` before it could pull,
  and replaced the plain push's ErrPushRejected hint. A push URL whose
  destination branch tip this clone lacks rejects the push as
  non-fast-forward and receives nothing, so it is now left out, and the
  check passes when every push URL is like that. `push --pull` re-runs the
  check after pulling, with the tip known.
- PushRemote read branch.<b>.remote even when @{u} no longer resolved, while
  PushArgs then pushed to origin. pushTarget now follows the same
  HasUpstream rule as PushArgs.
2026-10-04 03:09:17 +08:00
..