#!/usr/bin/env perl # Copyright (C) 2019 Sean Whitton # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use 5.028; use strict; use warnings; use DBD::SQLite; use Git::Wrapper; use Try::Tiny; use File::Spec::Functions qw(catfile); my $git = Git::Wrapper->new('.'); try { $git->rev_parse({ git_dir => 1 }); } catch { die "pwd doesn't look like a git repository ..\n"; }; my ($annex_dir) = $git->rev_parse({ git_path => 1 }, 'annex'); my $dbh = DBI->connect( "dbi:SQLite:dbname=" . catfile($annex_dir, "checksum-reinject"), "", ""); # TODO now build the database, but only if git-annex branch has # changed since database was last edited?