diff options
Diffstat (limited to 'bin/annex-checksum-reinject')
-rwxr-xr-x | bin/annex-checksum-reinject | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bin/annex-checksum-reinject b/bin/annex-checksum-reinject new file mode 100755 index 00000000..6d533046 --- /dev/null +++ b/bin/annex-checksum-reinject @@ -0,0 +1,41 @@ +#!/usr/bin/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 <http://www.gnu.org/licenses/>. + +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? |