locoti 0.1.3

A fork of Locot. A simple utility for tracking lines of code over time in a Git repository. Outputs CSV for visualization and analysis.
locoti-0.1.3 is not a library.

Locoti

Locoti is a fork of Locot. A simple utility for tracking lines of code over time in a Git repository. Outputs CSV for visualization and analysis.

Improvements over Locot

  • Reads commit trees directly from the local Git object database instead of cloning and checking out every revision.
  • Caches subtree stats by Git tree ID, so identical trees across history are counted once
  • Caches blob-level parsing and ignore decisions to reduce repeated work during history scans
  • Uses faster hash maps (rustc_hash::FxHashMap) in the hot path
  • Improves ignore filtering by respecting .gitignore and .ignore rules
  • Improves language detection for extensionless files via shebang detection

Performance

$ hyperfine 'locoti ./tokei' 'locot --path ./tokei'
Benchmark 1: locoti ./tokei
  Time (mean ± σ):     249.2 ms ±   8.6 ms
 
Benchmark 2: locot --path ./tokei
  Time (mean ± σ):      5.996 s ±  0.088 s
 
Summary
  locoti ./tokei ran 24.06 times faster than locot --path ./tokei

Install

From crates.io:

cargo install locoti

From this repository:

cargo install --path .

Usage

Analyze the current repository and save the results:

locoti > results.csv

Run interactively in a terminal to see a graph instead of raw CSV rows:

locoti

Analyze a specific repository path:

locoti /path/to/repo > results.csv

CLI options

Option Description
<PATH> Path to the repository to analyze (default: .)
-f, --format <FORMAT> Output format (currently csv; interactive terminals show a graph, redirected stdout stays CSV)
--exclude-language <LANGUAGE> Exclude an additional language from totals and CSV columns; repeat or comma-separate values
--include-language <LANGUAGE> Include a language that is excluded by default; repeat or comma-separate values
-h, --help Print help
-V, --version Print version

Output format

The CSV contains:

  • Commit: commit hash
  • Time: commit timestamp (UTC, RFC 3339 format)
  • Total: total lines counted at that commit, after language exclusions
  • Language columns: one column per language with non-zero lines in at least one commit

When stdout is attached to a terminal, locoti renders a terminal graph of total LOC over commit history instead of printing CSV rows. The graph labels the x-axis endpoints with the first and last commit dates. Redirect stdout to a file to keep the CSV output unchanged.

Example output

Commit Time Total Markdown Rust TOML
b9d3f2b3ecc975870cdf9efc714ed441c81caed2 2023-05-11T14:11:12Z 2 2 0 0
88ab06991a322fe6a731700c255b1a0b0ba5bddb 2023-05-11T14:15:32Z 7 7 0 0
fa8e52ae130e1e47e5ec71ff84ec9b3f7d3aa48f 2023-05-17T12:58:42Z 76 2 63 11
eb430bb6e3006974e42b67e8603fce10a6c10812 2023-05-17T13:02:03Z 86 2 73 11
46c56a4a92310242ad17d245db4932f00f726e4a 2023-05-17T13:03:08Z 83 2 70 11

License

GNU GPL v3