Documentation
¶
Overview ¶
Package git replays revisions in a git working tree (vcs.Replayer) and creates signed commits in a git store (vcs.Signer).
Index ¶
- Constants
- type Replayer
- func (g Replayer) Abort(ctx context.Context, ws vcs.Workspace) error
- func (g Replayer) Continue(ctx context.Context, ws vcs.Workspace) (vcs.Replay, error)
- func (g Replayer) Replay(ctx context.Context, ws vcs.Workspace, req vcs.ReplayRequest) (vcs.Replay, error)
- func (g Replayer) ReplayStatus(ctx context.Context, ws vcs.Workspace) (vcs.Replay, error)
- type Signer
Constants ¶
const ( // RefPrefix is where a signing's commits are kept. RefPrefix = "refs/core-sign/" // StateDir is the directory of the common git directory that holds the // signings' records. StateDir = "core-sign" )
const StateFile = "core-replay.json"
StateFile is the file in the worktree's git directory that holds a replay in progress.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Replayer ¶
type Replayer struct {
// Bin is the git executable; empty is "git".
Bin string
}
Replayer replays revisions in a git working tree, one commit at a time with cherry-pick, with the working tree detached at the replay's tip: no branch is moved. Each replayed commit keeps its original's message, author and committer, so the same replay of the same commits onto the same revision gives the same commit ids, and a commit that is or becomes empty is kept, so the caller's commit boundaries stay. A replay that stops on a conflict leaves it in the working tree for the caller to resolve, and its state in the worktree's git directory (StateFile). Replay refuses a working tree with changes to tracked files.
The zero Replayer runs "git" from PATH. It fetches and pushes nothing.
func (Replayer) Abort ¶
Abort drops a stopped cherry-pick, returns HEAD to what it was before the replay and forgets the replay. The commits it made are left to git's garbage collection.
func (Replayer) Continue ¶
Continue stages the working tree, refuses a conflicted path that still holds a conflict marker, commits the stopped commit with its original's message, author and committer, and replays the rest.
type Signer ¶
type Signer struct {
// Bin is the git executable; empty is "git".
Bin string
}
Signer creates signed commits with `git commit-tree -S`, in any git store: a working tree, a bare repository, or the git store a Jujutsu repository shares, colocated or under .jj/repo/store/git. The author and the committer are the repository's configured identity (user.name and user.email, or author.* and committer.*), and the signature is made with its signing key and format (user.signingKey, gpg.format and the gpg.*program the format names). An identity that is not configured is refused rather than guessed, and GIT_AUTHOR_* and GIT_COMMITTER_* in the process's environment are ignored. A commit whose object carries no signature is never recorded, so a misconfigured signer fails Sign.
Commit i of a signing is kept under the ref RefPrefix<id>/<i>, which no branch, tag or Jujutsu bookmark is, and the signing's record is StateDir/<id>.json in the repository's common git directory, written after each commit. A commit created and kept under its ref before the record said so is taken up by the next Sign or SignStatus once its tree, parents, message and signature are checked, so nothing is signed twice.
The zero Signer runs "git" from PATH. It fetches and pushes nothing, and runs no hook.