Code forensics  0.1
Generate historical information about code changes
git_interface.hpp File Reference
#include <git2.h>
#include "common.hpp"
#include <fmt/core.h>
#include <iostream>
#include "gitwrap.hpp"
Include dependency graph for git_interface.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  git::exception
 
struct  fmt::formatter< git_oid >
 
struct  DiffForeachParams
 
struct  std::hash< git_oid >
 Hash for git OID. More...
 

Namespaces

 git
 C++ wrapper for the libgit2 library.
 
 std
 

Macros

#define __GIT_THROW_EXCEPTION(code, function)   throw git::exception(code, function);
 

Functions

Str oid_tostr (git_oid oid)
 Convert git ID object to it's string representation. More...
 
void tree_walk (const git_tree *tree, git_treewalk_mode mode, Func< int(const char *, const git_tree_entry *)> callback)
 Iterate over the git tree in specified order using provided callback. More...
 
void diff_foreach (git_diff *diff, CR< DiffForeachParams > foreach)
 
bool operator== (CR< git_oid > lhs, CR< git_oid > rhs)
 Compare git OID for equality. More...
 
bool operator< (CR< git_oid > lhs, CR< git_oid > rhs)
 
std::ostream & operator<< (std::ostream &out, git_oid const &oid)
 

Detailed Description

This file provides helper types and wrappers for the libgit API

Macro Definition Documentation

◆ __GIT_THROW_EXCEPTION

#define __GIT_THROW_EXCEPTION (   code,
  function 
)    throw git::exception(code, function);

Function Documentation

◆ diff_foreach()

void diff_foreach ( git_diff *  diff,
CR< DiffForeachParams foreach 
)
inline
Parameters
diffA git_diff generated by one of the above functions.

◆ oid_tostr()

Str oid_tostr ( git_oid  oid)
inline

Convert git ID object to it's string representation.

◆ operator<()

bool operator< ( CR< git_oid >  lhs,
CR< git_oid >  rhs 
)
inline

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
git_oid const &  oid 
)
inline

◆ operator==()

bool operator== ( CR< git_oid >  lhs,
CR< git_oid >  rhs 
)
inline

Compare git OID for equality.

◆ tree_walk()

void tree_walk ( const git_tree *  tree,
git_treewalk_mode  mode,
Func< int(const char *, const git_tree_entry *)>  callback 
)
inline

Iterate over the git tree in specified order using provided callback.

Parameters
treePointer to the git tree to walk over
modeOrder of the tree walk
callbackCallback to execute on each entry in the tree. Should return GIT_OK value in order continue the iteration.
Note
both arguments are managed by the tree walk algorithm - if you need to store the root (1st argument) or the entry itself for some post-walk processing you need to use copy the string or use `git::entry_dup` for each argument respectively.