mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "libgit2"]
|
||||
path = libgit2
|
||||
url = git://github.com/pieter/libgit2.git
|
||||
@@ -80,6 +80,8 @@
|
||||
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 */; };
|
||||
F5C580F50EDA251100995434 /* 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,6 +216,7 @@
|
||||
F5B721C30E05CF7E00AF29DC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
F5C007730E731B48007B84B2 /* PBGitRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRef.h; sourceTree = "<group>"; };
|
||||
F5C007740E731B48007B84B2 /* PBGitRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRef.m; sourceTree = "<group>"; };
|
||||
F5C580E40EDA250900995434 /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.a; path = libgit2/libgit2.a; sourceTree = "<group>"; };
|
||||
F5C6F68B0E65FF9300478D97 /* PBGitLane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitLane.h; sourceTree = "<group>"; };
|
||||
F5C6F68C0E65FF9300478D97 /* PBGitLane.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PBGitLane.mm; sourceTree = "<group>"; };
|
||||
F5D2DC850EA401A80034AD24 /* PBGitConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitConfig.h; sourceTree = "<group>"; };
|
||||
@@ -259,6 +262,7 @@
|
||||
911112370E5A097800BF76B4 /* Security.framework in Frameworks */,
|
||||
F580E6AE0E733276009E2D3F /* Sparkle.framework in Frameworks */,
|
||||
F5E4DBFB0EAB58D90013FAFC /* SystemConfiguration.framework in Frameworks */,
|
||||
F5C580E50EDA250900995434 /* libgit2.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -273,6 +277,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F5C580F50EDA251100995434 /* libgit2.a in Frameworks */,
|
||||
F5886A1E0ED5D3880066E74C /* Cocoa.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -375,6 +380,7 @@
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F5C580E40EDA250900995434 /* libgit2.a */,
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
|
||||
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
|
||||
);
|
||||
@@ -578,6 +584,7 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 26FC0A840875C7B200E6366F /* Build configuration list for PBXNativeTarget "GitX" */;
|
||||
buildPhases = (
|
||||
F5792DFB0EDB570C001B0C31 /* Compilie libgit2 */,
|
||||
8D1107290486CEB800E47090 /* Resources */,
|
||||
8D11072C0486CEB800E47090 /* Sources */,
|
||||
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||
@@ -683,6 +690,20 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
F5792DFB0EDB570C001B0C31 /* Compilie libgit2 */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Compilie libgit2";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "git submodule init\ngit submodule update\ncd libgit2\nrm -f libgit2.a\nmake CFLAGS=\"-arch i386 -arch ppc\"\nranlib libgit2.a";
|
||||
};
|
||||
F5CF04A20EAE696C00D75C81 /* Copy HTML files */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -840,8 +861,10 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = GitX_Prefix.pch;
|
||||
HEADER_SEARCH_PATHS = libgit2/src;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
LIBRARY_SEARCH_PATHS = libgit2;
|
||||
PRODUCT_NAME = GitX;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = YES;
|
||||
@@ -860,8 +883,10 @@
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = GitX_Prefix.pch;
|
||||
HEADER_SEARCH_PATHS = libgit2/src;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
LIBRARY_SEARCH_PATHS = libgit2;
|
||||
PRODUCT_NAME = GitX;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -904,6 +929,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
LIBRARY_SEARCH_PATHS = libgit2;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Foundation,
|
||||
@@ -926,6 +952,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
LIBRARY_SEARCH_PATHS = libgit2;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Foundation,
|
||||
@@ -949,10 +976,13 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 2;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = GitX_Prefix.pch;
|
||||
HEADER_SEARCH_PATHS = libgit2/src;
|
||||
INFOPLIST_FILE = "SpeedTest-Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
LIBRARY_SEARCH_PATHS = libgit2;
|
||||
OTHER_CFLAGS = "-DCLI";
|
||||
OTHER_LDFLAGS = (
|
||||
"-L.",
|
||||
"-framework",
|
||||
Foundation,
|
||||
"-framework",
|
||||
@@ -976,6 +1006,7 @@
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/UIKit.framework/Headers/UIKit.h";
|
||||
INFOPLIST_FILE = "SpeedTest-Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
LIBRARY_SEARCH_PATHS = libgit2;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Foundation,
|
||||
|
||||
+6
-3
@@ -9,9 +9,10 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PBGitRepository.h"
|
||||
#import "PBGitTree.h"
|
||||
#include "git/oid.h"
|
||||
|
||||
@interface PBGitCommit : NSObject {
|
||||
NSString* sha;
|
||||
git_oid sha;
|
||||
NSString* subject;
|
||||
NSString* author;
|
||||
NSString* details;
|
||||
@@ -24,12 +25,14 @@
|
||||
PBGitRepository* repository;
|
||||
}
|
||||
|
||||
- initWithRepository:(PBGitRepository*) repo andSha:(NSString*) sha;
|
||||
- initWithRepository:(PBGitRepository *)repo andSha:(git_oid)sha;
|
||||
|
||||
- (void)addRef:(id)ref;
|
||||
- (void)removeRef:(id)ref;
|
||||
|
||||
@property (copy) NSString* sha;
|
||||
- (NSString *)realSha;
|
||||
|
||||
@property (readonly) git_oid *sha;
|
||||
@property (copy) NSString* subject;
|
||||
@property (copy) NSString* author;
|
||||
@property (retain) NSArray* parents;
|
||||
|
||||
+18
-5
@@ -11,7 +11,7 @@
|
||||
|
||||
@implementation PBGitCommit
|
||||
|
||||
@synthesize sha, repository, subject, author, date, parents, sign, lineInfo, refs;
|
||||
@synthesize repository, subject, author, date, parents, sign, lineInfo, refs;
|
||||
|
||||
|
||||
- (NSString *) dateString
|
||||
@@ -25,14 +25,27 @@
|
||||
return self.tree.children;
|
||||
}
|
||||
|
||||
- initWithRepository:(PBGitRepository*) repo andSha:(NSString*) newSha
|
||||
- (git_oid *)sha
|
||||
{
|
||||
return &sha;
|
||||
}
|
||||
|
||||
- initWithRepository:(PBGitRepository*) repo andSha:(git_oid)newSha
|
||||
{
|
||||
details = nil;
|
||||
self.repository = repo;
|
||||
self.sha = newSha;
|
||||
repository = repo;
|
||||
sha = newSha;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)realSha
|
||||
{
|
||||
char *hex = git_oid_mkhex(&sha);
|
||||
NSString *str = [NSString stringWithUTF8String:hex];
|
||||
free(hex);
|
||||
return str;
|
||||
}
|
||||
|
||||
// NOTE: This method should remain threadsafe, as we load it in async
|
||||
// from the web view.
|
||||
- (NSString*) details
|
||||
@@ -40,7 +53,7 @@
|
||||
if (details != nil)
|
||||
return details;
|
||||
|
||||
details = [self.repository outputForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]];
|
||||
details = [self.repository outputForCommand:[@"show --pretty=raw " stringByAppendingString:[self realSha]]];
|
||||
|
||||
return details;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
@interface PBGitGrapher : NSObject {
|
||||
PBGraphCellInfo* previous;
|
||||
void *pl;
|
||||
void *storage;
|
||||
int curLane;
|
||||
|
||||
NSDictionary* refs;
|
||||
PBGitRepository* repository;
|
||||
}
|
||||
|
||||
+5
-3
@@ -6,6 +6,10 @@
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
extern "C" {
|
||||
#import "git/oid.h"
|
||||
}
|
||||
|
||||
#import "PBGitGrapher.h"
|
||||
#import "PBGitCommit.h"
|
||||
#import "PBGitLane.h"
|
||||
@@ -31,7 +35,6 @@ using namespace std;
|
||||
|
||||
- (void) decorateCommit: (PBGitCommit *) commit
|
||||
{
|
||||
//NSLog(@"Decoriting commit %@", commit.sha);
|
||||
int i = 0, newPos = -1;
|
||||
std::vector<PBGitLane *> *currentLanes = new std::vector<PBGitLane *>;
|
||||
std::vector<PBGitLane *> *previousLanes = (std::vector<PBGitLane *> *)pl;
|
||||
@@ -48,7 +51,6 @@ using namespace std;
|
||||
i++;
|
||||
// This is our commit! We should do a "merge": move the line from
|
||||
// our upperMapping to their lowerMapping
|
||||
|
||||
if ((*it)->isCommit([commit sha])) {
|
||||
if (!didFirst) {
|
||||
didFirst = YES;
|
||||
@@ -116,7 +118,7 @@ using namespace std;
|
||||
// This boolean will tell us if that happened
|
||||
BOOL addedParent = NO;
|
||||
|
||||
for (NSString* parent in [commit.parents subarrayWithRange:NSMakeRange(1, [commit.parents count] -1)]) {
|
||||
for (NSString *parent in [commit.parents subarrayWithRange:NSMakeRange(1, [commit.parents count] -1)]) {
|
||||
int i = 0;
|
||||
BOOL was_displayed = NO;
|
||||
std::vector<PBGitLane *>::iterator it = currentLanes->begin();
|
||||
|
||||
+84
-84
@@ -3,14 +3,14 @@
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">9F33</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">672</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">670</string>
|
||||
<string key="IBDocument.AppKitVersion">949.34</string>
|
||||
<string key="IBDocument.HIToolboxVersion">352.00</string>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="236"/>
|
||||
<integer value="27"/>
|
||||
<integer value="263"/>
|
||||
<integer value="11"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -2361,87 +2361,6 @@
|
||||
<reference key="object" ref="144370985"/>
|
||||
<reference key="parent" ref="555671215"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">3</int>
|
||||
<reference key="object" ref="663765878"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="942510576"/>
|
||||
<reference ref="452331733"/>
|
||||
<reference ref="152625445"/>
|
||||
<reference ref="254268962"/>
|
||||
</object>
|
||||
<reference key="parent" ref="202620420"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">30</int>
|
||||
<reference key="object" ref="942510576"/>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">29</int>
|
||||
<reference key="object" ref="452331733"/>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">28</int>
|
||||
<reference key="object" ref="152625445"/>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">27</int>
|
||||
<reference key="object" ref="254268962"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="976830280"/>
|
||||
<reference ref="1025472344"/>
|
||||
<reference ref="792589327"/>
|
||||
</object>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
<string key="objectName">Commit List</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">33</int>
|
||||
<reference key="object" ref="976830280"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="853819733"/>
|
||||
</object>
|
||||
<reference key="parent" ref="254268962"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">32</int>
|
||||
<reference key="object" ref="1025472344"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="977219207"/>
|
||||
</object>
|
||||
<reference key="parent" ref="254268962"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">31</int>
|
||||
<reference key="object" ref="792589327"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="746918365"/>
|
||||
</object>
|
||||
<reference key="parent" ref="254268962"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">36</int>
|
||||
<reference key="object" ref="746918365"/>
|
||||
<reference key="parent" ref="792589327"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">35</int>
|
||||
<reference key="object" ref="977219207"/>
|
||||
<reference key="parent" ref="1025472344"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">34</int>
|
||||
<reference key="object" ref="853819733"/>
|
||||
<reference key="parent" ref="976830280"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">231</int>
|
||||
<reference key="object" ref="892732705"/>
|
||||
@@ -2686,6 +2605,87 @@
|
||||
<reference key="object" ref="882172208"/>
|
||||
<reference key="parent" ref="604026377"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">3</int>
|
||||
<reference key="object" ref="663765878"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="254268962"/>
|
||||
<reference ref="152625445"/>
|
||||
<reference ref="452331733"/>
|
||||
<reference ref="942510576"/>
|
||||
</object>
|
||||
<reference key="parent" ref="202620420"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">27</int>
|
||||
<reference key="object" ref="254268962"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="792589327"/>
|
||||
<reference ref="1025472344"/>
|
||||
<reference ref="976830280"/>
|
||||
</object>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
<string key="objectName">Commit List</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">31</int>
|
||||
<reference key="object" ref="792589327"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="746918365"/>
|
||||
</object>
|
||||
<reference key="parent" ref="254268962"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">36</int>
|
||||
<reference key="object" ref="746918365"/>
|
||||
<reference key="parent" ref="792589327"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">32</int>
|
||||
<reference key="object" ref="1025472344"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="977219207"/>
|
||||
</object>
|
||||
<reference key="parent" ref="254268962"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">35</int>
|
||||
<reference key="object" ref="977219207"/>
|
||||
<reference key="parent" ref="1025472344"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">33</int>
|
||||
<reference key="object" ref="976830280"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="853819733"/>
|
||||
</object>
|
||||
<reference key="parent" ref="254268962"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">34</int>
|
||||
<reference key="object" ref="853819733"/>
|
||||
<reference key="parent" ref="976830280"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">28</int>
|
||||
<reference key="object" ref="152625445"/>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">29</int>
|
||||
<reference key="object" ref="452331733"/>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">30</int>
|
||||
<reference key="object" ref="942510576"/>
|
||||
<reference key="parent" ref="663765878"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
@@ -2796,7 +2796,7 @@
|
||||
<string>com.apple.InterfaceBuilderKit</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{69, 366}, {616, 227}}</string>
|
||||
<string>{{312, 366}, {616, 227}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{132, 614}, {616, 0}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
||||
+20
-6
@@ -6,32 +6,46 @@
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
#import <Cocoa/Cocoa.h>
|
||||
extern "C"
|
||||
{
|
||||
#include "git/oid.h"
|
||||
}
|
||||
|
||||
class PBGitLane {
|
||||
static int s_colorIndex;
|
||||
|
||||
NSString *d_sha;
|
||||
git_oid d_sha;
|
||||
int d_index;
|
||||
|
||||
public:
|
||||
|
||||
PBGitLane(NSString *sha)
|
||||
PBGitLane(git_oid sha)
|
||||
{
|
||||
d_index = s_colorIndex++;
|
||||
d_sha = [sha copy];
|
||||
d_sha = sha;
|
||||
}
|
||||
|
||||
PBGitLane(NSString *sha)
|
||||
{
|
||||
git_oid_mkstr(&d_sha, [sha UTF8String]);
|
||||
d_index = s_colorIndex++;
|
||||
}
|
||||
|
||||
PBGitLane()
|
||||
{
|
||||
d_index = s_colorIndex++;
|
||||
d_sha = NULL;
|
||||
//d_sha = NULL;
|
||||
}
|
||||
|
||||
bool isCommit(git_oid *sha) const;
|
||||
bool isCommit(NSString *sha) const;
|
||||
|
||||
void setSha(git_oid sha);
|
||||
void setSha(NSString *sha);
|
||||
NSString *sha() const
|
||||
|
||||
git_oid const *sha() const
|
||||
{
|
||||
return [d_sha copy];
|
||||
return &d_sha;
|
||||
}
|
||||
|
||||
int index() const;
|
||||
|
||||
+21
-3
@@ -24,10 +24,22 @@
|
||||
|
||||
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
|
||||
{
|
||||
//NSLog(@"Comparing %@ with %@", d_sha, sha);
|
||||
return [d_sha isEqualToString:sha];
|
||||
git_oid a = str_to_oid(sha);
|
||||
return isCommit(&a);
|
||||
}
|
||||
|
||||
int PBGitLane::index() const
|
||||
@@ -35,11 +47,17 @@ int PBGitLane::index() const
|
||||
return d_index;
|
||||
}
|
||||
|
||||
void PBGitLane::setSha(NSString *sha)
|
||||
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;
|
||||
|
||||
+11
-4
@@ -6,6 +6,11 @@
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "git/oid.h"
|
||||
}
|
||||
|
||||
#import "PBGitRevList.h"
|
||||
#import "PBGitRepository.h"
|
||||
#import "PBGitCommit.h"
|
||||
@@ -116,7 +121,9 @@ using namespace std;
|
||||
}
|
||||
|
||||
// From now on, 1.2 seconds
|
||||
PBGitCommit* newCommit = [[PBGitCommit alloc] initWithRepository: repository andSha: [NSString stringWithUTF8String:sha.c_str()]];
|
||||
git_oid oid;
|
||||
git_oid_mkstr(&oid, sha.c_str());
|
||||
PBGitCommit* newCommit = [[PBGitCommit alloc] initWithRepository:repository andSha:oid];
|
||||
|
||||
string author;
|
||||
getline(stream, author, '\0');
|
||||
@@ -154,11 +161,11 @@ using namespace std;
|
||||
}
|
||||
|
||||
[revisions addObject: newCommit];
|
||||
//[g decorateCommit: newCommit];
|
||||
[g decorateCommit: newCommit];
|
||||
|
||||
// 0.1 second on linux-2.6
|
||||
if (refs && [refs objectForKey:newCommit.sha])
|
||||
newCommit.refs = [refs objectForKey:newCommit.sha];
|
||||
if (refs && [refs objectForKey:[newCommit realSha]])
|
||||
newCommit.refs = [refs objectForKey:[newCommit realSha]];
|
||||
|
||||
if (++num % 1000 == 0)
|
||||
[self performSelectorOnMainThread:@selector(setCommits:) withObject:revisions waitUntilDone:NO];
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
PBGitTree* tree = [[self alloc] init];
|
||||
tree.parent = nil;
|
||||
tree.leaf = NO;
|
||||
tree.sha = c.sha;
|
||||
tree.sha = [c realSha];
|
||||
tree.repository = c.repository;
|
||||
tree.path = @"";
|
||||
return tree;
|
||||
|
||||
@@ -38,12 +38,12 @@
|
||||
return;
|
||||
|
||||
// The sha is the same, but refs may have changed.. reload it lazy
|
||||
if ([currentSha isEqualToString: content.sha])
|
||||
if ([currentSha isEqualToString: [content realSha]])
|
||||
{
|
||||
[[self script] callWebScriptMethod:@"reload" withArguments: nil];
|
||||
return;
|
||||
}
|
||||
currentSha = content.sha;
|
||||
currentSha = [content realSha];
|
||||
|
||||
NSArray *arguments = [NSArray arrayWithObjects:content, [[[historyController repository] headRef] simpleRef], nil];
|
||||
[[self script] callWebScriptMethod:@"loadCommit" withArguments: arguments];
|
||||
|
||||
@@ -4,7 +4,7 @@ var Commit = function(obj) {
|
||||
|
||||
this.refs = obj.refs;
|
||||
this.author_name = obj.author;
|
||||
this.sha = obj.sha;
|
||||
this.sha = obj.realSha();
|
||||
this.parents = obj.parents;
|
||||
this.subject = obj.subject;
|
||||
|
||||
|
||||
Submodule
+1
Submodule libgit2 added at bda29d0f7b
Reference in New Issue
Block a user