NAME

Cogit::Util

VERSION

version 0.001001

SYNOPSIS

use Cogit::Util;
use Cogit;

my $repo = Cogit->new(
    gitdir => current_git_dir(),
);

FUNCTIONS

is_git_dir

Determines if the given $dir has the basic requirements of a Git repository dir.

( ie: either a checkouts .git folder, or a bare repository )

if ( is_git_dir( $dir ) ) {
    ...
}

find_git_dir

my $dir = find_git_dir( $subdir );

Finds the closest .git or bare tree that is either at $subdir or somewhere above $subdir

If $subdir is inside a 'bare' repo, returns the path to that repo.

If $subdir is inside a checkout, returns the path to the checkouts .git dir.

If $subdir is not inside a git repo, returns a false value.

current_git_dir

Finds the closest .git or bare tree by walking up parents.

my $git_dir = current_git_dir();

If $CWD is inside a bare repo somewhere, it will return the path to the bare repo root directory.

If $CWD is inside a git checkout, it will return the path to the .git folder of that checkout.

If $CWD is not inside any recognisable git repo, will return a false value.

AUTHOR

Arthur Axel "fREW" Schmidt <cogit@afoolishmanifesto.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.