jj / How jj util backend works

How jj util backend works

jj util backend groups commands about the current repo's commit backend. It has one: jj util backend name.

On this page
  1. 1. Command-line surface
  2. 3. End-to-end flow
  3. 4. Core architecture touchpoints

In short: jj util backend name loads the repo without snapshotting and prints the backend's name(), the same string jj wrote to .jj/repo/store/type when the repo was created: git for the Git backend, Simple for the simple backend.

The group is UtilBackendCommand, help text "Commands relating to the backend used in the current repo". It is the Backend variant of UtilCommand (source, dispatch). Its only subcommand is cmd_util_backend_name, "Print the name of the backend used in the current repo" (source).

1. Command-line surface

SubcommandArgumentsMeaning
namenonePrints the backend name and a newline to stdout (source).

The global flags are on the CLI page.

3. End-to-end flow

jj util backend name: call flow cmd_util_backend dispatches the name subcommand to cmd_util_backend_name, which loads the workspace with workspace_helper_no_snapshot and prints repo.store().backend().name(). workspace_helper_no_snapshot load repo; working copy untouched store().backend().name() "git", "Simple", …

4. Core architecture touchpoints

PieceRole here
Backend::name"A unique name that identifies this backend", written to .jj/repo/store/type at repo creation. More on the backends page.
Backend implementationsGitBackend::NAME = "git" (source), SimpleBackend::NAME = "Simple" (source), and the test-only SecretBackend::NAME = "secret" (source). Upstream's test checks the first two (test).
Working copy, operation logNot touched: no snapshot and no transaction.