#git-log #git-history #data-file #point #collect #repo #once

bin+lib git-historian

Git Historian allows you to collect arbitrary data about a file at each point in its Git history. Think of it as "git log --follow" for every file in a repo, all at once

3 unstable releases

Uses old Rust 2015

0.4.0 Mar 4, 2017
0.3.4 Mar 4, 2017
0.3.3 Nov 14, 2016
0.3.2 Nov 13, 2016

#27 in #git-history

GPL-2.0 license

21KB
336 lines

Git Historian allows you to collect arbitrary data about a file at each point in its Git history.

Think of it as git log --follow for every file in a repo, all at once.

Why?

It can be useful for automating tasks that require knowledge of a file's history, e.g., updating each source file's copyright header with the years during which the file was modified (because Legal said so).

How?

The library gathers commit info by parsing the output of git log --name-status, then builds a tree of the history of all files we care about. See parsing.rs and history.rs for details.

Why Rust?

Because it's awesome (and I wanted to try it out for a Real™ project).


lib.rs:

This crate analyzes a Git repository (by parsing git log --name-status), then builds a tree of the history for a provided list of files.

At each node (corresponding to a delta in the file's history), a user-provided callback is issued to gather desired information.

See main.rs for a quick demo.

Dependencies

~0.6–1MB
~14K SLoC