Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

irmin/test/cram: add log.t

Exercises [irmin log]: full chain walk, -n N truncation, JSON output,
unknown-branch error. Author/email are pinned by helpers.sh so only
the short hash needs scrubbing. The blank line between commits is
part of the visible UX and is checked as-is.

+54
+54
test/cram/log.t/run.t
··· 1 + irmin log - walk the commit chain 2 + 3 + [log] walks a branch's commit history through first-parent links, 4 + most-recent first. Each commit prints as: 5 + 6 + <short-hash> <name> <<email>> 7 + <message> 8 + 9 + with a blank line between commits. [-n N] caps the chain length. 10 + [-o json] emits a JSON array of [{hash, author, email, message}] 11 + objects. 12 + 13 + helpers.sh pins GIT_AUTHOR_* / GIT_COMMITTER_* so author/email are 14 + stable. Short hashes remain volatile; scrub them in the test. 15 + 16 + Set up a repo with three commits: 17 + 18 + $ mkdir testrepo 19 + $ cd testrepo 20 + $ irmin init . 2>&1 > /dev/null 21 + $ irmin set a.txt 'A' -m 'c1' 2>&1 > /dev/null 22 + $ irmin set b.txt 'B' -m 'c2' 2>&1 > /dev/null 23 + $ irmin set c.txt 'C' -m 'c3' 2>&1 > /dev/null 24 + 25 + Full log (most-recent first). Scrub the leading short hash to HASH: 26 + 27 + $ irmin log | sed -E 's/^[0-9a-f]{7} /HASH /' 28 + HASH irmin <irmin@local> 29 + c3 30 + 31 + HASH irmin <irmin@local> 32 + c2 33 + 34 + HASH irmin <irmin@local> 35 + c1 36 + 37 + 38 + [-n 1] caps at the most recent commit: 39 + 40 + $ irmin log -n 1 | sed -E 's/^[0-9a-f]{7} /HASH /' 41 + HASH irmin <irmin@local> 42 + c3 43 + 44 + 45 + JSON output: one array element per commit, full-length hashes scrubbed: 46 + 47 + $ irmin log -o json -n 2 | sed -E 's/"hash":"[0-9a-f]+"/"hash":"HASH"/g' 48 + [{"hash":"HASH","author":"irmin","email":"irmin@local","message":"c3"},{"hash":"HASH","author":"irmin","email":"irmin@local","message":"c2"}] 49 + 50 + Unknown branch: error and non-zero exit. 51 + 52 + $ irmin log -b missing 53 + ✗ Branch missing not found 54 + [1]