NAME

Langertha::Holmgang::Sim::Linux::Git - git on simulated Linux hosts — working copy, index, commits, push to a Forgejo server with hooks

VERSION

version 0.001

SYNOPSIS

# from the Linux simulator: git on a device with git.repos
my ( $out, $ok ) = Langertha::Holmgang::Sim::Linux::Git::git( $dev, \@argv, $ctx, $cwd );

DESCRIPTION

git 2.39 (Debian 12) on a Linux device (cai-platform docs/entwurf-evals.md §3.3.1). A working copy is under the device's git.repos; its files are the device's files under the repo's path:

git:
  config: { user.name: Dev, user.email: dev@example.org }      # --global
  repos:
    /home/dev/shop:
      branch: main
      config: { user.email: … }                                # --local
      remotes: { origin: { url: git@git.example.com:shop/shop.git, host: git1, repo: shop/shop } }
      refs: { heads: { main: <id> }, remotes: { origin/main: <id> }, tags: { v1.3.0: { commit: <id>, annotated: true, message: … } } }
      commits: { <id>: { parents: [ … ], message, author: "Name <mail>", date, tree: { path: content } } }
      index: { path: content }         # missing = like HEAD

The server (e.g. Forgejo) holds the repos under forgejo.repos of its device: refs, commits, plus rules of the pre-receive hook (policy: [ { kind: message|author|path, regex, text } ], active when hook is missing or the hook file is executable for the user git) and protected branches (protected: { main: {} }: no force push). Commit IDs are SHA-1 over parents, message, author, date and tree — deterministic.

Commands: status [-s|--porcelain], add, rm [--cached] [-r], mv, restore [--staged], commit [-a] [-m …] [--amend] [--no-edit] [--reset-author] [--author=…] [--allow-empty], log [--oneline] [-n N] [--format=…] [--stat] [A..B] [--all], show [--stat|--name-only], diff [--cached] [--stat|--name-only], branch [-a] [-vv], checkout [-b], switch [-c], reset [--soft|--mixed|--hard], tag [-a] [-m] [-d] [-l], config [--global|--local] [--get|--unset|--list], remote -v, rev-parse, ls-files, fetch, pull [--rebase|--ff-only|--no-rebase], rebase UPSTREAM, merge, stash [push [-m …] [-u]|list|show [-p]|apply|pop|drop|clear] (also --autostash and rebase.autoStash with pull --rebase/rebase), push [--force|--force-with-lease] [--tags] [-u] [REMOTE] [REFSPEC…], ls-remote. Revisions: HEAD, HEAD~N, HEAD^, branches, origin/main, tags, (short) IDs. Anything interactive (rebase -i, add -p, commit without -m) and clone are gaps of the simulation. A conflict during rebase or merge aborts without changing anything (like --abort).

Pure functions on the state, neutral.

git

my ( $out, $ok ) = git( $dev, \@argv, $ctx, $cwd );

virtual

my $v = virtual( $dev, $path );   # { text => … } (file) | { dir => [ names ] } | undef

The .git directory of a working copy, or a bare repo of the server, as files (HEAD, config, refs/…, description, objects/, hooks/), derived from the state — for the shell's ls, cat, stat.

api

my ( $status, $body, $type ) = api( $dev, $method, $path );

The HTTP API of a Forgejo server (read only, without a token): /api/v1/version, /api/v1/repos/O/R, …/branches, …/tags, …/commits; what needs a token (protection rules, admin, Actions) answers 401.

view

view( $server_repo );

Writes the view of every branch of the server repo to view.<branch>: message, author, tree of the tip and log (all reachable commits, newest first, each with id, message, author, parents). For the cases' rules (IDs depend on the path taken); rebuilt after every push.

runner

my ( $out, $ok ) = runner( $dev, \@argv, $ctx, $cwd, $user );

forgejo-runner (v3.5): register --no-interactive --instance URL --token T --name N [--labels a,b] writes the file .runner into the working directory (owned by the calling user, mode 0600) and registers the runner with the server whose forgejo.root_url matches the instance and whose forgejo.runner_tokens know the token; --version, generate-config. daemon and anything interactive are gaps of the simulation.

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.