Files
gitx/PBGitLane.mm
T
Pieter de Bie d2eafc2d52 Include libgit2 as submodule and use it to store sha's
This reduces GitX's memory usage and makes some operations much faster,
like graphing, by having a cheaper comparison
2008-11-24 22:53:48 +01:00

65 lines
960 B
Plaintext

//
// PBGitLane.m
// GitX
//
// Created by Pieter de Bie on 27-08-08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "PBGitLane.h"
//class PBGitLane {
// static int s_colorIndex;
//
// char d_sha[20];
// int d_index;
//
//public:
// PBGitLane(NSString *sha);
//
// bool isCommit(NSString *sha) const;
// int index(); const;
//
// static resetColors();
//};
int PBGitLane::s_colorIndex = 0;
static git_oid str_to_oid(NSString *str)
{
git_oid oid;
git_oid_mkstr(&oid, [str UTF8String]);
return oid;
}
bool PBGitLane::isCommit(git_oid *sha) const
{
return !git_oid_cmp(&d_sha, sha);
}
bool PBGitLane::isCommit(NSString *sha) const
{
git_oid a = str_to_oid(sha);
return isCommit(&a);
}
int PBGitLane::index() const
{
return d_index;
}
void PBGitLane::setSha(git_oid sha)
{
d_sha = sha;
}
void PBGitLane::setSha(NSString *sha)
{
return setSha(str_to_oid(sha));
}
void PBGitLane::resetColors()
{
s_colorIndex = 0;
}