The strategy is about representing the initial state of a file, adding patches (which add changes to a file), and the reconstruction of a file from a given patch's ancestor tree is about calculating offsets.
A rough schema looks like...
// the initial file
CREATE TABLE IF NOT EXISTS files (
id INTEGER PRIMARY KEY AUTOINCREMENT,
directory INTEGER CHECK( directory in (0, 1) ) NOT NULL DEFAULT 0,
content BLOB DEFAULT NULL,
added_on INTEGER NOT NULL,