IF Commons GitHub

AnyFS Git: push and fetch

0005Active

0005-git-remote · owner if · domain commons

Requirements

FR-001checkpassing

A push MUST send the branch of the store and no other reference, MUST never be forced, and a remote that has commits the branch lacks MUST end as a rejected value that says so and leaves the remote as it was.

Enforced (check): .github: cd commons/anyfs-git && bun run verify — suite/remote.test.ts

Proved by: anyfs-git/suite/remote.test.ts

Written in: anyfs-git/src/physical/ref/remote.ts

Tests: passed: suite/remote.test.ts a push sends the branch and no other, is never forced, and a remote that has commits the b

FR-002checkpassing

A fetch MUST read the remote's branch into a private reference and move the branch of the store only where that is a fast-forward (or the branch is not yet made); a branch that has diverged MUST be left as it is and said to have diverged, a branch the local store is ahead with MUST be said so, and a remote with no such branch MUST be said to be absent.

Enforced (check): .github: cd commons/anyfs-git && bun run verify — suite/remote.test.ts

Proved by: anyfs-git/suite/remote.test.ts

Written in: anyfs-git/src/physical/ref/remote.ts

Tests: passed: suite/remote.test.ts a fetch makes the branch, fast-forwards it, says where the store is ahead, and leaves a br

FR-003checkpassing

The name of a remote MUST be refused where it starts with a dash, holds a control character or names a transport that runs a program, and only the transports for files, Git, SSH and the web MUST be allowed.

Enforced (check): .github: cd commons/anyfs-git && bun run verify — suite/remote.test.ts

Proved by: anyfs-git/suite/remote.test.ts

Written in: anyfs-git/src/physical/ref/remote.ts

Tests: passed: suite/remote.test.ts the name of a remote is refused before Git sees it where it is an option, holds a control

Acceptance scenarios

  1. Given a bare remote, When the branch is pushed, Then the remote has the branch at the tip, per FR-001.
  2. Given a remote that another writer has moved, When the branch is pushed, Then it is rejected and the remote keeps the other writer's commit, per FR-001.
  3. Given a remote ahead of the branch, When it is fetched, Then the branch is fast-forwarded, and a diverged branch is left and said so, per FR-002.
  4. Given the name --upload-pack=x or ext::sh, When a push is asked for, Then it is refused before Git sees it, per FR-003.

Out of scope

  • Pushing to GitHub or GitLab through their interfaces: that is the library for managed hosts.

Edge cases

  • A remote with no such branch is said to be absent and is not an error (FR-002).

Assumptions

Open questions

  • None.

Key entities

  • Branch, Working tree, Revision, Identity.

Success criteria

SC-001success criterion

Every behaviour is tested in real repositories in temporary folders, with no network and no real time.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Cited by

AnyFS Git: the store of a branch, AnyFS Git: conformance

Titles, headings, exports, tables, columns and requirements. Esc closes.