Git::LowLevel - LowLevel Blob/Tree/Commit operations on a GIT Repository
version 0.3
Git::LowLevel is a Perl Module for using gits low level functions to create and read blobs, trees, commits and references.
Git::LowLevel is not intended to be used for script based committing or something like that.
It main indent is to create/read references and their trees while you have checked out abother branch.
use Git::LowLevel; my $repository = Git::LowLevel->new(git_dir => "/tmp/repo"); my $ref = $repository->getReference("refs/heads/master"); my $tree = $ref->getTree(); die ("reference does not exist") unless $ref->exist(); die ("no files in tree") unless !$tree->empty(); my $blob = $tree->find("/doc/doxygen.conf"); die("no blob found") unless defined($blob) && ref($blob) eq "Git::LowLevel::Blob"; print $blob->content;
use Git::LowLevel; my $repository = Git::LowLevel->new(git_dir => "/tmp/repo"); my $ref = $repository->getReference("refs/heads/master"); my $tree = $ref->getTree(); my $newblob = $tree->newBlob(); $newblob->path("hello"); $newblob->_content("Hello World"); $tree->add($newblob); $ref->commit("added hello");
directory of the git repository
path to the git command, default is to search in your path
private attribute
holds the value if this repository is a bare one or not
private method
checks if git_dir is a git repository
called after new for internal setup
returns a reference object from the given reference path
@param none
@return Git::LowLevel::Reference object
Dominik Meyer <dmeyer@federationhq.de>
This software is Copyright (c) 2018 by Dominik Meyer.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991
To install Git::LowLevel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::LowLevel
CPAN shell
perl -MCPAN -e shell install Git::LowLevel
For more information on module installation, please visit the detailed CPAN module installation guide.