diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-01-08 11:01:48 +0000 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-01-08 11:01:48 +0000 |
commit | 6596883be13d92830497fe8d15751107376a3ade (patch) | |
tree | ec1f611878d606644104259196c63dd76c23bd26 /bin/annex-checksum-reinject | |
parent | e170bc9421e95936becf926a53c9cbb255ad85c6 (diff) | |
download | dotfiles-6596883be13d92830497fe8d15751107376a3ade.tar.gz |
annex-checksum-reinject TODO script
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? |