NAME

Dist::Conformance::Source::Git - Standards fetched from a git repository into a cache directory

VERSION

version 0.001

SYNOPSIS

use 5.040;
use Dist::Conformance::Source::Git;

my $source = Dist::Conformance::Source::Git->new(
    url  => 'https://forge.test.test/standards.git',
    ref  => 'main',
    path => 'skills/packaging-perl',
);
my $flavor = $source->file('conformance/troglodyne.yml');    # fetches first

DESCRIPTION

A tree of standards in a git repository. The first read through "root" fetches the latest commit of "ref" into a clone under "cache", and checks it out. Later reads by the same object use that checkout, so one run sees one commit, however many files it reads.

Each URL and ref has a clone of its own, in a directory named by the SHA-1 of the two, so two flavors at two refs of one repository do not fight over a checkout. The clone is a cache: deleting it costs one full clone the next time.

ATTRIBUTES

url

Required. Anything that git clone takes: a URL, or the path of a repository on this machine.

ref

The branch, tag or commit to fetch. Default HEAD, the default branch of the remote.

cache

The directory that holds the clones. Default dist-conformance under $XDG_CACHE_HOME, or under ~/.cache when that is not set.

offline

When true, "root" fetches nothing, and uses the clone as the last fetch left it. Dies when there is no clone yet.

METHODS

new

Dies unless "url" is given, and on a URL or a ref that git would take for an option.

clone_dir

The directory of the clone of this URL and ref, as a Mojo::File.

root

The checkout, after a "fetch" unless "offline". Memoized on the object.

fetch

Clones the repository if there is no clone yet, fetches "ref", and checks out what it fetched, discarding any change in the checkout. Dies with what git said when a step fails.

describe

The URL and the ref.

FUNCTIONS

git

(@arguments). Runs git with @arguments, and dies with its standard error when it fails. Every call to git goes through this function, so a test can replace it.

SEE ALSO

Please see those modules/websites for more information related to this module.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/Troglodyne-Internet-Widgets/Dist-Conformance/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHORS

Current Maintainers:

  • George S. Baugh <george@troglodyne.net>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Troglodyne LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.