Merge branch 'refs/heads/no_libgit2'

This commit is contained in:
German Laullon
2011-05-20 01:39:57 +02:00
24 changed files with 69 additions and 399 deletions
-3
View File
@@ -1,3 +0,0 @@
[submodule "libgit2"]
path = libgit2
url = git://github.com/RomainMuller/libgit2.git
+1 -1
View File
@@ -155,7 +155,7 @@
- (void) selectCommit:(NSString*)c
{
[historyController selectCommit:[PBGitSHA shaWithString:c]];
[historyController selectCommit:c];
}
// TODO: need to be refactoring
-72
View File
@@ -129,7 +129,6 @@
D8F01C4B12182F19007F729F /* GitX.sdef in Resources */ = {isa = PBXBuildFile; fileRef = D8F01C4A12182F19007F729F /* GitX.sdef */; };
D8F01D531218A164007F729F /* NSApplication+GitXScripting.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F01D521218A164007F729F /* NSApplication+GitXScripting.m */; };
D8F4AB7912298CE200D6D53C /* rewindImage.pdf in Resources */ = {isa = PBXBuildFile; fileRef = D8F4AB7812298CE200D6D53C /* rewindImage.pdf */; };
D8FBCF19115FA20C0098676A /* PBGitSHA.m in Sources */ = {isa = PBXBuildFile; fileRef = D8FBCF18115FA20C0098676A /* PBGitSHA.m */; };
D8FDD9F711432A12005647F6 /* PBCloneRepositoryPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = D8FDD9F511432A12005647F6 /* PBCloneRepositoryPanel.xib */; };
D8FDDA6A114335E8005647F6 /* PBGitSVBranchItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D8FDDA5D114335E8005647F6 /* PBGitSVBranchItem.m */; };
D8FDDA6B114335E8005647F6 /* PBGitSVFolderItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D8FDDA5F114335E8005647F6 /* PBGitSVFolderItem.m */; };
@@ -178,7 +177,6 @@
F5AD56790E79B78100EDAAFE /* PBCommitList.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AD56780E79B78100EDAAFE /* PBCommitList.m */; };
F5B721C40E05CF7E00AF29DC /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F5B721C20E05CF7E00AF29DC /* MainMenu.xib */; };
F5C007750E731B48007B84B2 /* PBGitRef.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C007740E731B48007B84B2 /* PBGitRef.m */; };
F5C580E50EDA250900995434 /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C580E40EDA250900995434 /* libgit2.a */; };
F5C6F68D0E65FF9300478D97 /* PBGitLane.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5C6F68C0E65FF9300478D97 /* PBGitLane.mm */; };
F5DFFA6C0E075D8800617813 /* PBEasyFS.m in Sources */ = {isa = PBXBuildFile; fileRef = F5DFFA6B0E075D8800617813 /* PBEasyFS.m */; };
F5E424110EA3E4D60046E362 /* PBDiffWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = F5E424100EA3E4D60046E362 /* PBDiffWindow.xib */; };
@@ -214,13 +212,6 @@
remoteGlobalIDString = 913D5E480E55644600CECEA2;
remoteInfo = "cli tool";
};
D8022C1911DFE8ED003C21F6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = D8022B1411DFCE7F003C21F6;
remoteInfo = libgit2;
};
F5643A010F792B4900A579C2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
@@ -417,8 +408,6 @@
D8F01D521218A164007F729F /* NSApplication+GitXScripting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSApplication+GitXScripting.m"; sourceTree = "<group>"; };
D8F01D841218A406007F729F /* GitX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GitX.h; sourceTree = "<group>"; };
D8F4AB7812298CE200D6D53C /* rewindImage.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = rewindImage.pdf; path = Images/rewindImage.pdf; sourceTree = "<group>"; };
D8FBCF17115FA20C0098676A /* PBGitSHA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitSHA.h; sourceTree = "<group>"; };
D8FBCF18115FA20C0098676A /* PBGitSHA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitSHA.m; sourceTree = "<group>"; };
D8FDD9F611432A12005647F6 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/PBCloneRepositoryPanel.xib; sourceTree = "<group>"; };
D8FDDA5C114335E8005647F6 /* PBGitSVBranchItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitSVBranchItem.h; sourceTree = "<group>"; };
D8FDDA5D114335E8005647F6 /* PBGitSVBranchItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitSVBranchItem.m; sourceTree = "<group>"; };
@@ -560,7 +549,6 @@
911112370E5A097800BF76B4 /* Security.framework in Frameworks */,
F580E6AE0E733276009E2D3F /* Sparkle.framework in Frameworks */,
F5E4DBFB0EAB58D90013FAFC /* SystemConfiguration.framework in Frameworks */,
F5C580E50EDA250900995434 /* libgit2.a in Frameworks */,
D8E3B2B810DC9FB2001096A3 /* ScriptingBridge.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1084,8 +1072,6 @@
F56524EF0E02D45200F03B52 /* PBGitCommit.m */,
F5C007730E731B48007B84B2 /* PBGitRef.h */,
F5C007740E731B48007B84B2 /* PBGitRef.m */,
D8FBCF17115FA20C0098676A /* PBGitSHA.h */,
D8FBCF18115FA20C0098676A /* PBGitSHA.m */,
D8295D281130A1DC00C838E8 /* PBGitHistoryList.h */,
D8295D291130A1DC00C838E8 /* PBGitHistoryList.m */,
F5FF4E160E0829C20006317A /* PBGitRevList.h */,
@@ -1146,22 +1132,6 @@
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */
D8022B1411DFCE7F003C21F6 /* libgit2 */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "\"${PROJECT_DIR}/build_libgit2.sh\"";
buildConfigurationList = D8022B1C11DFCE98003C21F6 /* Build configuration list for PBXLegacyTarget "libgit2" */;
buildPhases = (
);
buildToolPath = /bin/sh;
dependencies = (
);
name = libgit2;
passBuildSettingsInEnvironment = 1;
productName = libgit2;
};
/* End PBXLegacyTarget section */
/* Begin PBXNativeTarget section */
551BF110112F371800265053 /* gitx_askpasswd */ = {
isa = PBXNativeTarget;
@@ -1196,7 +1166,6 @@
551BF175112F3F3500265053 /* PBXTargetDependency */,
913D5E5A0E5564F400CECEA2 /* PBXTargetDependency */,
F5643A020F792B4900A579C2 /* PBXTargetDependency */,
D8022C1A11DFE8ED003C21F6 /* PBXTargetDependency */,
);
name = GitX;
productInstallPath = "$(HOME)/Applications";
@@ -1242,7 +1211,6 @@
8D1107260486CEB800E47090 /* GitX */,
913D5E480E55644600CECEA2 /* cli tool */,
F56439F70F792B2100A579C2 /* Generate PList Prefix */,
D8022B1411DFCE7F003C21F6 /* libgit2 */,
551BF110112F371800265053 /* gitx_askpasswd */,
);
};
@@ -1452,7 +1420,6 @@
D8295D2A1130A1DC00C838E8 /* PBGitHistoryList.m in Sources */,
D8295DE01130E43900C838E8 /* PBGitHistoryGrapher.m in Sources */,
D8E105471157C18200FC28A4 /* PBQLTextView.m in Sources */,
D8FBCF19115FA20C0098676A /* PBGitSHA.m in Sources */,
D8022FED11E124C8003C21F6 /* PBGitXMessageSheet.m in Sources */,
D8EB616A122F643E00FCCAF4 /* GitXRelativeDateFormatter.m in Sources */,
D8F01D531218A164007F729F /* NSApplication+GitXScripting.m in Sources */,
@@ -1506,11 +1473,6 @@
target = 913D5E480E55644600CECEA2 /* cli tool */;
targetProxy = 913D5E590E5564F400CECEA2 /* PBXContainerItemProxy */;
};
D8022C1A11DFE8ED003C21F6 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D8022B1411DFCE7F003C21F6 /* libgit2 */;
targetProxy = D8022C1911DFE8ED003C21F6 /* PBXContainerItemProxy */;
};
F5643A020F792B4900A579C2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F56439F70F792B2100A579C2 /* Generate PList Prefix */;
@@ -1820,31 +1782,6 @@
};
name = Release;
};
D8022B1511DFCE7F003C21F6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = libgit2;
SDKROOT = "";
};
name = Debug;
};
D8022B1611DFCE7F003C21F6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
PRODUCT_NAME = libgit2;
SDKROOT = "";
ZERO_LINK = NO;
};
name = Release;
};
F56439F80F792B2100A579C2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -1911,15 +1848,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D8022B1C11DFCE98003C21F6 /* Build configuration list for PBXLegacyTarget "libgit2" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D8022B1511DFCE7F003C21F6 /* Debug */,
D8022B1611DFCE7F003C21F6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F56439FD0F792B3600A579C2 /* Build configuration list for PBXAggregateTarget "Generate PList Prefix" */ = {
isa = XCConfigurationList;
buildConfigurations = (
+4 -5
View File
@@ -10,14 +10,13 @@
#import "PBGitRepository.h"
#import "PBGitTree.h"
#import "PBGitRefish.h"
#import "PBGitSHA.h"
extern NSString * const kGitXCommitType;
@interface PBGitCommit : NSObject <PBGitRefish> {
PBGitSHA *sha;
NSString *sha;
NSString* subject;
NSString* author;
@@ -33,8 +32,8 @@ extern NSString * const kGitXCommitType;
PBGitRepository* repository;
}
+ (PBGitCommit *)commitWithRepository:(PBGitRepository*)repo andSha:(PBGitSHA *)newSha;
- (id)initWithRepository:(PBGitRepository *)repo andSha:(PBGitSHA *)newSha;
+ (PBGitCommit *)commitWithRepository:(PBGitRepository*)repo andSha:(NSString *)newSha;
- (id)initWithRepository:(PBGitRepository *)repo andSha:(NSString *)newSha;
- (void) addRef:(PBGitRef *)ref;
- (void) removeRef:(id)ref;
@@ -49,7 +48,7 @@ extern NSString * const kGitXCommitType;
- (NSString *) shortName;
- (NSString *) refishType;
@property (readonly) PBGitSHA *sha;
@property (readonly) NSString *sha;
@property (copy) NSString* subject;
@property (copy) NSString* author;
@property (copy) NSString *committer;
+3 -4
View File
@@ -7,7 +7,6 @@
//
#import "PBGitCommit.h"
#import "PBGitSHA.h"
#import "PBGitDefaults.h"
@@ -38,12 +37,12 @@ NSString * const kGitXCommitType = @"commit";
return self.tree.children;
}
+ (PBGitCommit *)commitWithRepository:(PBGitRepository*)repo andSha:(PBGitSHA *)newSha
+ (PBGitCommit *)commitWithRepository:(PBGitRepository*)repo andSha:(NSString *)newSha
{
return [[self alloc] initWithRepository:repo andSha:newSha];
}
- (id)initWithRepository:(PBGitRepository*) repo andSha:(PBGitSHA *)newSha
- (id)initWithRepository:(PBGitRepository*) repo andSha:(NSString *)newSha
{
details = nil;
repository = repo;
@@ -53,7 +52,7 @@ NSString * const kGitXCommitType = @"commit";
- (NSString *)realSha
{
return sha.string;
return sha;
}
- (BOOL) isOnSameBranchAs:(PBGitCommit *)otherCommit
+6 -7
View File
@@ -11,7 +11,6 @@
#import "PBGitLane.h"
#import "PBGitGraphLine.h"
#import <list>
#import <git2/oid.h>
using namespace std;
@@ -48,7 +47,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
PBGitLane *currentLane = NULL;
BOOL didFirst = NO;
git_oid commit_oid = [[commit sha] oid];
NSString *commit_oid = [commit sha];
// First, iterate over earlier columns and pass through any that don't want this commit
if (previous != nil) {
@@ -88,8 +87,8 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
// If we already did the first parent, don't do so again
if (!didFirst && currentLanes->size() < MAX_LANES && nParents) {
git_oid parentOID = [[parents objectAtIndex:0] oid];
PBGitLane *newLane = new PBGitLane(&parentOID);
NSString *parentOID = [parents objectAtIndex:0];
PBGitLane *newLane = new PBGitLane(parentOID);
currentLanes->push_back(newLane);
newPos = currentLanes->size();
add_line(lines, &currentLine, 0, newPos, newPos, newLane->index());
@@ -103,7 +102,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
int parentIndex = 0;
for (parentIndex = 1; parentIndex < nParents; ++parentIndex) {
git_oid parentOID = [[parents objectAtIndex:parentIndex] oid];
NSString *parentOID = [parents objectAtIndex:parentIndex];
int i = 0;
BOOL was_displayed = NO;
std::list<PBGitLane *>::iterator it = currentLanes->begin();
@@ -123,7 +122,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
// Really add this parent
addedParent = YES;
PBGitLane *newLane = new PBGitLane(&parentOID);
PBGitLane *newLane = new PBGitLane(parentOID);
currentLanes->push_back(newLane);
add_line(lines, &currentLine, 0, currentLanes->size(), newPos, newLane->index());
}
@@ -150,7 +149,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
// Update the current lane to point to the new parent
if (currentLane && nParents > 0)
currentLane->setSha([[parents objectAtIndex:0] oid]);
currentLane->setSha([parents objectAtIndex:0]);
else
currentLanes->remove(currentLane);
+2 -2
View File
@@ -18,7 +18,7 @@
@class QLPreviewPanel;
@class PBCommitList;
@class GLFileView;
@class PBGitSHA;
@class NSString;
@class PBHistorySearchController;
@@ -71,7 +71,7 @@
- (IBAction) setTreeView:(id)sender;
- (IBAction) setBranchFilter:(id)sender;
- (void)selectCommit:(PBGitSHA *)commit;
- (void)selectCommit:(NSString *)commit;
- (IBAction) refresh:(id)sender;
- (IBAction) toggleQLPreviewPanel:(id)sender;
- (IBAction) openSelectedFile:(id)sender;
+2 -2
View File
@@ -447,7 +447,7 @@
commitList.useAdjustScroll = NO;
}
- (NSArray *) selectedObjectsForSHA:(PBGitSHA *)commitSHA
- (NSArray *) selectedObjectsForSHA:(NSString *)commitSHA
{
NSPredicate *selection = [NSPredicate predicateWithFormat:@"sha == %@", commitSHA];
NSArray *selectedCommits = [[commitController content] filteredArrayUsingPredicate:selection];
@@ -458,7 +458,7 @@
return selectedCommits;
}
- (void)selectCommit:(PBGitSHA *)commitSHA
- (void)selectCommit:(NSString *)commitSHA
{
if (!forceSelectionUpdate && [[[[commitController selectedObjects] lastObject] sha] isEqual:commitSHA])
return;
+1 -2
View File
@@ -8,7 +8,6 @@
#import "PBGitHistoryGrapher.h"
#import "PBGitGrapher.h"
#import "PBGitSHA.h"
@implementation PBGitHistoryGrapher
@@ -47,7 +46,7 @@
for (PBGitCommit *commit in revList) {
if ([currentThread isCancelled])
return;
PBGitSHA *commitSHA = [commit sha];
NSString *commitSHA = [commit sha];
if (viewAllBranches || [searchSHAs containsObject:commitSHA]) {
[grapher decorateCommit:commit];
[commits addObject:commit];
+1 -2
View File
@@ -14,7 +14,6 @@
@class PBGitRef;
@class PBGitRevList;
@class PBGitHistoryGrapher;
@class PBGitSHA;
@interface PBGitHistoryList : NSObject {
PBGitRepository *repository;
@@ -22,7 +21,7 @@
PBGitRevList *projectRevList;
PBGitRevList *currentRevList;
PBGitSHA *lastSHA;
NSString *lastSHA;
NSSet *lastRefSHAs;
NSInteger lastBranchFilter;
PBGitRef *lastRemoteRef;
+4 -5
View File
@@ -11,7 +11,6 @@
#import "PBGitRevList.h"
#import "PBGitGrapher.h"
#import "PBGitHistoryGrapher.h"
#import "PBGitSHA.h"
@@ -168,7 +167,7 @@
NSMutableSet *baseCommitSHAs = [NSMutableSet set];
NSDictionary *refs = repository.refs;
for (PBGitSHA *sha in refs)
for (NSString *sha in refs)
for (PBGitRef *ref in [refs objectForKey:sha])
if ([ref isBranch] || [ref isTag])
[baseCommitSHAs addObject:sha];
@@ -187,7 +186,7 @@
PBGitRef *remoteRef = [[repository.currentBranch ref] remoteRef];
for (PBGitSHA *sha in refs)
for (NSString *sha in refs)
for (PBGitRef *ref in [refs objectForKey:sha])
if ([remoteRef isEqualToRef:[ref remoteRef]])
[baseCommitSHAs addObject:sha];
@@ -203,7 +202,7 @@
return [NSMutableSet setWithObject:lastSHA];
else if ([repository.currentBranch isSimpleRef]) {
PBGitRef *currentRef = [repository.currentBranch ref];
PBGitSHA *sha = [repository shaForRef:currentRef];
NSString *sha = [repository shaForRef:currentRef];
if (sha)
return [NSMutableSet setWithObject:sha];
}
@@ -273,7 +272,7 @@
return NO;
}
PBGitSHA *revSHA = [repository shaForRef:[rev ref]];
NSString *revSHA = [repository shaForRef:[rev ref]];
if ([revSHA isEqual:lastSHA] && (lastBranchFilter == repository.currentBranchFilter))
return NO;
+6 -20
View File
@@ -6,46 +6,32 @@
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#include <git2/oid.h>
class PBGitLane {
static int s_colorIndex;
git_oid d_sha;
NSString *d_sha;
int d_index;
public:
PBGitLane(git_oid *sha)
{
d_index = s_colorIndex++;
d_sha = *sha;
}
PBGitLane(NSString *sha)
{
git_oid_mkstr(&d_sha, [sha UTF8String]);
d_index = s_colorIndex++;
d_sha = sha;
}
PBGitLane()
{
d_index = s_colorIndex++;
}
bool isCommit(git_oid sha) const
bool isCommit(NSString *sha) const
{
return !git_oid_cmp(&d_sha, &sha);
}
void setSha(git_oid sha);
git_oid const *sha() const
{
return &d_sha;
return [d_sha isEqual:sha];
}
void setSha(NSString *sha);
int index() const;
static void resetColors();
};
+1 -1
View File
@@ -29,7 +29,7 @@ int PBGitLane::index() const
return d_index;
}
void PBGitLane::setSha(git_oid sha)
void PBGitLane::setSha(NSString *sha)
{
d_sha = sha;
}
+7 -7
View File
@@ -42,7 +42,7 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
@class PBGitWindowController;
@class PBGitCommit;
@class PBGitSHA;
@class NSString;
@interface PBGitRepository : NSDocument {
PBGitHistoryList* revisionList;
@@ -55,7 +55,7 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
NSMutableDictionary *refs;
PBGitRevSpecifier *_headRef; // Caching
PBGitSHA* _headSha;
NSString* _headSha;
PBStashController *stashController;
PBSubmoduleController *submoduleController;
@@ -112,13 +112,13 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
- (void) addRef:(PBGitRef *)ref fromParameters:(NSArray *)params;
- (void) lazyReload;
- (PBGitRevSpecifier*)headRef;
- (PBGitSHA *)headSHA;
- (NSString *)headSHA;
- (PBGitCommit *)headCommit;
- (PBGitSHA *)shaForRef:(PBGitRef *)ref;
- (NSString *)shaForRef:(PBGitRef *)ref;
- (PBGitCommit *)commitForRef:(PBGitRef *)ref;
- (PBGitCommit *)commitForSHA:(PBGitSHA *)sha;
- (BOOL)isOnSameBranch:(PBGitSHA *)baseSHA asSHA:(PBGitSHA *)testSHA;
- (BOOL)isSHAOnHeadBranch:(PBGitSHA *)testSHA;
- (PBGitCommit *)commitForSHA:(NSString *)sha;
- (BOOL)isOnSameBranch:(NSString *)baseSHA asSHA:(NSString *)testSHA;
- (BOOL)isSHAOnHeadBranch:(NSString *)testSHA;
- (BOOL)isRefOnHeadBranch:(PBGitRef *)testRef;
- (BOOL)checkRefFormat:(NSString *)refName;
- (BOOL)refExists:(PBGitRef *)ref;
+12 -12
View File
@@ -274,11 +274,11 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
{
NSString* type = [components objectAtIndex:1];
PBGitSHA *sha;
NSString *sha;
if ([type isEqualToString:@"tag"] && [components count] == 4)
sha = [PBGitSHA shaWithString:[components objectAtIndex:3]];
sha = [components objectAtIndex:3];
else
sha = [PBGitSHA shaWithString:[components objectAtIndex:2]];
sha = [components objectAtIndex:2];
if(!sha) {
NSLog(@"sha was nil...? ref=%@, components=%@",ref,components);
@@ -410,7 +410,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
return _headRef;
}
- (PBGitSHA *)headSHA
- (NSString *)headSHA
{
if (! _headSha)
[self headRef];
@@ -423,12 +423,12 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
return [self commitForSHA:[self headSHA]];
}
- (PBGitSHA *)shaForRef:(PBGitRef *)ref
- (NSString *)shaForRef:(PBGitRef *)ref
{
if (!ref)
return nil;
for (PBGitSHA *sha in refs)
for (NSString *sha in refs)
for (PBGitRef *existingRef in [refs objectForKey:sha])
if ([existingRef isEqualToRef:ref])
return sha;
@@ -439,7 +439,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
if (retValue || [shaForRef isEqualToString:@""])
return nil;
return [PBGitSHA shaWithString:shaForRef];
return shaForRef;
}
- (PBGitCommit *)commitForRef:(PBGitRef *)ref
@@ -450,7 +450,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
return [self commitForSHA:[self shaForRef:ref]];
}
- (PBGitCommit *)commitForSHA:(PBGitSHA *)sha
- (PBGitCommit *)commitForSHA:(NSString *)sha
{
if (!sha)
return nil;
@@ -467,7 +467,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
return nil;
}
- (BOOL)isOnSameBranch:(PBGitSHA *)branchSHA asSHA:(PBGitSHA *)testSHA
- (BOOL)isOnSameBranch:(NSString *)branchSHA asSHA:(NSString *)testSHA
{
if (!branchSHA || !testSHA)
return NO;
@@ -480,7 +480,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
NSMutableSet *searchSHAs = [NSMutableSet setWithObject:branchSHA];
for (PBGitCommit *commit in revList) {
PBGitSHA *commitSHA = [commit sha];
NSString *commitSHA = [commit sha];
if ([searchSHAs containsObject:commitSHA]) {
if ([testSHA isEqual:commitSHA])
return YES;
@@ -494,12 +494,12 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
return NO;
}
- (BOOL)isSHAOnHeadBranch:(PBGitSHA *)testSHA
- (BOOL)isSHAOnHeadBranch:(NSString *)testSHA
{
if (!testSHA)
return NO;
PBGitSHA *headSHA = [self headSHA];
NSString *headSHA = [self headSHA];
if ([testSHA isEqual:headSHA])
return YES;
+8 -8
View File
@@ -17,8 +17,6 @@
#include <string>
#include <map>
#include <git2/errors.h>
using namespace std;
@@ -159,11 +157,11 @@ using namespace std;
}
}
git_oid oid;
if(git_oid_mkstr(&oid, sha.c_str())!=GIT_SUCCESS)
NSString *oid=[NSString stringWithCString:sha.c_str() encoding:encoding];
if([oid length]!=40)
break;
PBGitCommit *newCommit = [PBGitCommit commitWithRepository:repository andSha:[PBGitSHA shaWithOID:oid]];
PBGitCommit *newCommit = [PBGitCommit commitWithRepository:repository andSha:oid];
if (showSign)
[newCommit setSign: sign];
@@ -176,6 +174,7 @@ using namespace std;
string parentString;
getline(stream, parentString, '\1');
if (parentString.size() != 0)
{
if (((parentString.size() + 1) % 41) != 0) {
@@ -185,9 +184,10 @@ using namespace std;
int nParents = (parentString.size() + 1) / 41;
NSMutableArray *parents = [NSMutableArray arrayWithCapacity:nParents];
int parentIndex;
for (parentIndex = 0; parentIndex < nParents; ++parentIndex)
[parents addObject:[PBGitSHA shaWithCString:parentString.substr(parentIndex * 41, 40).c_str()]];
for (parentIndex = 0; parentIndex < nParents; ++parentIndex) {
NSString *pOid=[NSString stringWithCString:parentString.substr(parentIndex * 41, 40).c_str() encoding:encoding];
[parents addObject:pOid];
}
[newCommit setParents:parents];
}
+2 -2
View File
@@ -60,10 +60,10 @@
- (BOOL) isCurrentCommit
{
PBGitSHA *thisSha = [self.objectValue sha];
NSString *thisSha = [self.objectValue sha];
PBGitRepository* repository = [self.objectValue repository];
PBGitSHA *currentSha = [repository headSHA];
NSString *currentSha = [repository headSHA];
return [currentSha isEqual:thisSha];
}
-28
View File
@@ -1,28 +0,0 @@
//
// PBGitSHA.h
// GitX
//
// Created by BrotherBard on 3/28/10.
// Copyright 2010 BrotherBard. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#include <git2/oid.h>
@interface PBGitSHA : NSObject <NSCopying> {
git_oid oid;
NSString *string;
}
+ (PBGitSHA *)shaWithOID:(git_oid)oid;
+ (PBGitSHA *)shaWithString:(NSString *)shaString;
+ (PBGitSHA *)shaWithCString:(const char *)shaCString;
- (BOOL)isEqualToOID:(git_oid)other_oid;
@property (readonly) git_oid oid;
@property (readonly) NSString *string;
@end
-139
View File
@@ -1,139 +0,0 @@
//
// PBGitSHA.m
// GitX
//
// Created by BrotherBard on 3/28/10.
// Copyright 2010 BrotherBard. All rights reserved.
//
#import "PBGitSHA.h"
#import <git2/errors.h>
@interface PBGitSHA ()
- (id)initWithOID:(git_oid)g_oid;
@end
@implementation PBGitSHA
@synthesize oid;
@synthesize string;
+ (PBGitSHA *)shaWithOID:(git_oid)oid
{
return [[PBGitSHA alloc] initWithOID:oid];
}
+ (PBGitSHA *)shaWithString:(NSString *)shaString
{
git_oid oid;
int err = git_oid_mkstr(&oid, [shaString UTF8String]);
if (err == GIT_ENOTOID)
return nil;
return [self shaWithOID:oid];
}
+ (PBGitSHA *)shaWithCString:(const char *)shaCString
{
git_oid oid;
int err = git_oid_mkstr(&oid, shaCString);
if (err == GIT_ENOTOID)
return nil;
return [self shaWithOID:oid];
}
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
{
return NO;
}
+ (BOOL)isKeyExcludedFromWebScript:(const char *)name
{
return NO;
}
#pragma mark -
#pragma mark PBGitSHA
- (id)initWithOID:(git_oid)g_oid
{
self = [super init];
if (!self)
return nil;
oid = g_oid;
return self;
}
- (NSString *)string
{
if (!string) {
char *hex = git_oid_allocfmt(&oid);
if (hex == NULL)
return nil;
string = [NSString stringWithUTF8String:hex];
free(hex);
}
return string;
}
- (BOOL)isEqual:(id)otherSHA
{
if (self == otherSHA)
return YES;
git_oid other_oid = [(PBGitSHA *)otherSHA oid];
return git_oid_cmp(&oid, &other_oid) == 0;
}
- (BOOL)isEqualToOID:(git_oid)other_oid
{
return git_oid_cmp(&oid, &other_oid) == 0;
}
- (NSUInteger)hash
{
NSUInteger hash;
memcpy(&hash, &(oid.id), sizeof(NSUInteger));
return hash;
}
- (NSString *)description
{
return [self string];
}
#pragma mark <NSCopying>
- (id)copyWithZone:(NSZone *)zone
{
git_oid oidCopy;
git_oid_cpy(&oidCopy, &oid);
PBGitSHA *copy = [[[self class] allocWithZone:zone] initWithOID:oidCopy];
return copy;
}
@end
+1 -1
View File
@@ -442,7 +442,7 @@
for (NSString *resultSHA in resultsArray) {
NSUInteger index = 0;
for (PBGitCommit *commit in [commitController arrangedObjects]) {
if ([resultSHA isEqualToString:commit.sha.string]) {
if ([resultSHA isEqualToString:commit.sha]) {
[indexes addIndex:index];
break;
}
+2 -2
View File
@@ -14,13 +14,13 @@
#import "PBRefContextDelegate.h"
@class PBGitSHA;
@class NSString;
@interface PBWebHistoryController : PBWebController {
IBOutlet PBGitHistoryController* historyController;
IBOutlet id<PBRefContextDelegate> contextMenuDelegate;
PBGitSHA* currentSha;
NSString* currentSha;
NSString* diff;
}
+6 -7
View File
@@ -8,7 +8,6 @@
#import "PBWebHistoryController.h"
#import "PBGitDefaults.h"
#import "PBGitSHA.h"
#import "GLFileView.h"
#import <CommonCrypto/CommonDigest.h>
@@ -57,7 +56,7 @@
// but this caused some funny behaviour because NSTask's and NSThread's don't really
// like each other. Instead, just do it async.
NSMutableArray *taskArguments = [NSMutableArray arrayWithObjects:@"show", @"--numstat", @"--summary", @"--pretty=raw", [currentSha string], nil];
NSMutableArray *taskArguments = [NSMutableArray arrayWithObjects:@"show", @"--numstat", @"--summary", @"--pretty=raw", currentSha, nil];
if (![PBGitDefaults showWhitespaceDifferences])
[taskArguments insertObject:@"-w" atIndex:1];
@@ -107,17 +106,17 @@
NSMutableDictionary *stats=[self parseStats:details];
// File list
NSString *dt=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff-tree", @"--root", @"-r", @"-C90%", @"-M90%", [currentSha string], nil]];
NSString *dt=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff-tree", @"--root", @"-r", @"-C90%", @"-M90%", currentSha, nil]];
NSString *fileList=[GLFileView parseDiffTree:dt withStats:stats];
// Diffs list
NSString *d=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff-tree", @"--root", @"--cc", @"-C90%", @"-M90%", [currentSha string], nil]];
NSString *d=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff-tree", @"--root", @"--cc", @"-C90%", @"-M90%", currentSha, nil]];
NSString *diffs=[GLFileView parseDiff:d];
NSString *html=[NSString stringWithFormat:@"%@%@<div id='diffs'>%@</div>",header,fileList,diffs];
html=[html stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:[NSString stringWithFormat:@"%@^",[currentSha string]]];
html=[html stringByReplacingOccurrencesOfString:@"{SHA}" withString:[currentSha string]];
html=[html stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:[NSString stringWithFormat:@"%@^",currentSha]];
html=[html stringByReplacingOccurrencesOfString:@"{SHA}" withString:currentSha];
[[view windowScriptObject] callWebScriptMethod:@"showCommit" withArguments:[NSArray arrayWithObject:html]];
@@ -223,7 +222,7 @@
- (void)selectCommit:(NSString *)sha
{
[historyController selectCommit:[PBGitSHA shaWithString:sha]];
[historyController selectCommit:sha];
}
// TODO: need to be refactoring
-66
View File
@@ -1,66 +0,0 @@
#!/bin/sh
# build_libgit2.sh
# GitX
#
# Created by BrotherBard on 7/3/10.
# Copyright 2010 BrotherBard. All rights reserved.
#
# based on: http://log.yeahrightkeller.com/post/270155578/run-script-while-cleaning-in-xcode
buildAction () {
echo "Building libgit2..."
if [[ -d .git ]]
then
if [ "$(which git)" == "" ]; then
echo "git not found"
exit -1
fi
git submodule init
git submodule sync
git submodule update
cd libgit2
CFLAGS='-arch i386 -arch x86_64'
./waf --out=$TARGET_TEMP_DIR --prefix=$TARGET_BUILD_DIR configure
if [ $? != 0 ]; then
echo "error: failed to waf configure"
exit -1
fi
./waf build-static
if [ $? != 0 ]; then
echo "error: failed to waf build-static"
exit -1
fi
ranlib $TARGET_TEMP_DIR/static/libgit2.a
cp $TARGET_TEMP_DIR/static/libgit2.a $TARGET_BUILD_DIR
else
echo "error: Not a git repository."
echo "error: clone GitX first so that the libgit2 submodule can be updated"
exit 1
fi
}
cleanAction () {
echo "Cleaning libgit2..."
cd libgit2
./waf clean
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# MAIN
#echo "Running with ACTION=${ACTION}"
case $ACTION in
# NOTE: it gets set to "" rather than "build" when doing a build.
"")
buildAction
;;
"clean")
cleanAction
;;
esac
exit 0
Submodule libgit2 deleted from d1685ac7e9