Dominik Meyer

NAME

Git::LowLevel - LowLevel Blob/Tree/Commit operations on a GIT Repository

VERSION

version 0.3

DESCRIPTION

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.

EXAMPLE1

  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;

EXAMPLE2

  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");

ATTRIBUTES

git_dir

directory of the git repository

gitcmd

path to the git command, default is to search in your path

bare

private attribute

holds the value if this repository is a bare one or not

METHODS

_isGit

private method

checks if git_dir is a git repository

BUILD

private method

called after new for internal setup

getReference

returns a reference object from the given reference path

@param none

@return Git::LowLevel::Reference object

AUTHOR

Dominik Meyer <dmeyer@federationhq.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Dominik Meyer.

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991