Next: (maak guix), Previous: (maak dsl), Up: API
The git commands a project’s Maak file usually wants, and the source archives it usually ships, as procedures rather than tasks. A Maak file decides which of them to expose, and under which names:
(define-module (maak) #:use-module (maak git)) (define (commit message) "Commit every tracked change." (git-commit message))
Every command goes through ‘run’, which hands the arguments to git as a list: a commit message with spaces or quotes reaches git as one argument, and no shell splits it again. Nothing here assumes a project layout – the archive helpers take the file name and the prefix, and ‘git’ itself takes ‘#:directory’ – so the same procedures serve a checkout here and one elsewhere.
A command that fails stops the task with git’s own message and a maak error naming the command, the way any other ‘run’ does.
Run git with ARGUMENTS, a list of strings, in DIRECTORY.
This is what every wrapper below is made of, and the way to reach a command that has no wrapper – ‘git-fetch’, ‘git-reset’, a subcommand added tomorrow. Nothing is handed to a shell, so a value with spaces in it stays one argument.
(git (list "fetch" "--all")) (git (list "log" "--oneline" "-3") #:directory "/path/to/checkout")
A command that exits non-zero raises a maak error naming it, unless ALLOW-FAILURE? is #t, in which case the call answers #f.
Stage PATHS, or every change in the tree when none is named.
Write REVISION as OUTPUT with git archive, under PREFIX, in FORMAT.
FORMAT is one git archive understands, ‘tar.gz’ and ‘zip’ being the usual ones. PREFIX is the directory the archive unpacks into, and it carries its own trailing slash. DIRECTORY is the checkout to read from.
(git-archive "maak-1.0.tar.gz" #:prefix "maak-1.0/")
Write REVISION as the gzipped tarball OUTPUT, under PREFIX.
Write REVISION as the zip OUTPUT, under PREFIX.
List the branches, or create the branches NAMES name.
Commit every tracked change with MESSAGE.
Initialise a git repository here, with any arguments git init takes.
Show the history as a decorated one-line graph, twenty commits by default.
Pull from the upstream branch, with any arguments git pull takes.
Push the current branch, with any arguments git push takes.
A bare push does not send tags that are not annotated; ‘(git-push "–tags")’ sends them too.
Show the current branch and a short status of the working tree.
Switch to BRANCH, which must already exist.
Tag the current commit as NAME, without an annotation.
Next: (maak guix), Previous: (maak dsl), Up: API