ani
Pijul, written in C. I do this to gain a thorough understanding of Pijul’s internals and the way patches are represented and worked with. A secondary, distant goal is to create an alternate implementation that could act as a point of comparison to the Rust implementation.
Dependencies
To build you need a compiler for C11, the meson build system and ninja. (muon and samurai might also work.)
The following libraries should be available (as shared libraries):
These dependencies are vendored (in the vendor directory):
- blake3 for hashes
- zstd seekable a seekable variant of zstd
Build
Initially, run make setup to create the build directory.
Run make to build the project.
To run tests, run make check.
Code style
Fundamental rules:
- No header file includes another header file (vendored dependencies are exempted from this)
- Formatted with clang-format - execute
make fmtto get formatting right
Header files
Simple rule: include files should never include include files (see pikestyle). Instead they state (in comments or implicitly) what files they need to have included first, the problem of deciding which files to include is pushed to the user. (vendored header files are exempted from this rule to make it easier to update a vendored dependency.)
In addition, system include files should be grouped first before any user include files, and the first user include file must be common.h. All .c files in this project must include common.h As an example, this is the correct way to include files:
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include "common.h"
#include "atom.h"
Prefer to leave a blank line in between the system includes and user includes.
Type declarations
Use typedef sparingly, only for creating an alias for a type. Structs
should not be typedef’d, instead we use the struct keyword. Names
should be lowercase, preferably without underscores.
A correct declaration looks as follows:
struct changeheader {
...
};
Mirrored to git
There is a git mirror maintained on https://git.sr.ht/~laumann/ani. This mirror is maintained using andybalhom/pijul-export.
Use the following command to update the git mirror:
$ pijul-export --repo <ani-path> --marks pijul-marks | git fast-import --import-marks=git-marks --export-marks=git-marks
Links
- getopt(3p): https://portal.mozz.us/gemini/laumann.srht.site/c/getopt.gmi
- https://pijul.org/manual/
stdint.h(0p)- for uint64_t types, etc