Browse files

Update for libgit2 great renaming

  • Loading branch information...
1 parent a67a41e commit b5196cb2943fea1e05d09c94fc9e2585ddd1f77f @arrbee arrbee committed Nov 28, 2012
View
2 Classes/GTBlob.h
@@ -43,7 +43,7 @@
- (id)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
- (id)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
-- (size_t)size;
+- (git_off_t)size;
- (NSString *)content;
- (NSData *)data;
View
14 Classes/GTBlob.m
@@ -87,7 +87,7 @@ - (id)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:
- (id)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error {
git_oid oid;
- int gitError = git_blob_create_fromfile(&oid, repository.git_repository, [[file path] UTF8String]);
+ int gitError = git_blob_create_fromworkdir(&oid, repository.git_repository, [[file path] UTF8String]);
if(gitError < GIT_OK) {
if(error != NULL) {
*error = [NSError git_errorFor:gitError withAdditionalDescription:@"Failed to create blob from NSURL"];
@@ -102,22 +102,22 @@ - (git_blob *)git_blob {
return (git_blob *) self.git_object;
}
-- (size_t)size {
+- (git_off_t)size {
return git_blob_rawsize(self.git_blob);
}
- (NSString *)content {
- size_t s = [self size];
- if(s == 0) return @"";
+ git_off_t s = [self size];
+ if(s <= 0) return @"";
return [NSString stringWithUTF8String:git_blob_rawcontent(self.git_blob)];
}
- (NSData *)data {
- size_t s = [self size];
- if (s == 0) return [NSData data];
+ git_off_t s = [self size];
+ if (s <= 0) return [NSData data];
- return [NSData dataWithBytes:git_blob_rawcontent(self.git_blob) length:s];
+ return [NSData dataWithBytes:git_blob_rawcontent(self.git_blob) length:(size_t)s];
}
@end
View
2 Classes/GTConfiguration.m
@@ -75,7 +75,7 @@ - (int64_t)int64ForKey:(NSString *)key {
}
- (BOOL)deleteValueForKey:(NSString *)key error:(NSError **)error {
- git_config_delete(self.git_config, key.UTF8String);
+ git_config_delete_entry(self.git_config, key.UTF8String);
return YES;
}
View
6 Classes/GTIndex.h
@@ -58,11 +58,11 @@
- (void)clear;
// Get entries from the index
-- (GTIndexEntry *)entryAtIndex:(NSUInteger)theIndex;
-- (GTIndexEntry *)entryWithName:(NSString *)name;
+- (const GTIndexEntry *)entryAtIndex:(NSUInteger)theIndex;
+- (const GTIndexEntry *)entryWithName:(NSString *)name;
// Add entries to the index
-- (BOOL)addEntry:(GTIndexEntry *)entry error:(NSError **)error;
+- (BOOL)addEntry:(const GTIndexEntry *)entry error:(NSError **)error;
- (BOOL)addFile:(NSString *)file error:(NSError **)error;
// Write the index to the datastore
View
6 Classes/GTIndex.m
@@ -92,16 +92,16 @@ - (void)clear {
git_index_clear(self.git_index);
}
-- (GTIndexEntry *)entryAtIndex:(NSUInteger)theIndex {
+- (const GTIndexEntry *)entryAtIndex:(NSUInteger)theIndex {
return [GTIndexEntry indexEntryWithEntry:git_index_get_byindex(self.git_index, (unsigned int)theIndex)];
}
-- (GTIndexEntry *)entryWithName:(NSString *)name {
+- (const GTIndexEntry *)entryWithName:(NSString *)name {
int i = git_index_find(self.git_index, [name UTF8String]);
return [GTIndexEntry indexEntryWithEntry:git_index_get_byindex(self.git_index, (unsigned int)i)];
}
-- (BOOL)addEntry:(GTIndexEntry *)entry error:(NSError **)error {
+- (BOOL)addEntry:(const GTIndexEntry *)entry error:(NSError **)error {
int gitError = git_index_add(self.git_index, entry.git_index_entry);
if(gitError < GIT_OK) {
if(error != NULL)
View
4 Classes/GTIndexEntry.h
@@ -57,8 +57,8 @@ typedef enum {
@property (nonatomic, unsafe_unretained) GTRepository *repository;
// Convenience initializers
-- (id)initWithEntry:(git_index_entry *)theEntry;
-+ (id)indexEntryWithEntry:(git_index_entry *)theEntry;
+- (id)initWithEntry:(const git_index_entry *)theEntry;
++ (id)indexEntryWithEntry:(const git_index_entry *)theEntry;
- (NSString *)sha;
- (BOOL)setSha:(NSString *)theSha error:(NSError **)error;
View
4 Classes/GTIndexEntry.m
@@ -60,7 +60,7 @@ - (void)dealloc {
@synthesize valid;
@synthesize repository;
-+ (id)indexEntryWithEntry:(git_index_entry *)theEntry {
++ (id)indexEntryWithEntry:(const git_index_entry *)theEntry {
if (theEntry == NULL)
return nil;
@@ -74,7 +74,7 @@ - (id)init {
return self;
}
-- (id)initWithEntry:(git_index_entry *)theEntry {
+- (id)initWithEntry:(const git_index_entry *)theEntry {
if((self = [self init])) {
if (theEntry)
{
View
22 Classes/GTReference.m
@@ -85,14 +85,14 @@ - (id)initByCreatingReferenceNamed:(NSString *)refName fromReferenceTarget:(NSSt
self.repository = theRepo;
if (git_oid_fromstr(&oid, [theTarget UTF8String]) == GIT_OK) {
- gitError = git_reference_create_oid(&git_reference,
- self.repository.git_repository,
- [refName UTF8String],
- &oid,
- 0);
+ gitError = git_reference_create(&git_reference,
+ self.repository.git_repository,
+ [refName UTF8String],
+ &oid,
+ 0);
}
else {
- gitError = git_reference_create_symbolic(&git_reference,
+ gitError = git_reference_symbolic_create(&git_reference,
self.repository.git_repository,
[refName UTF8String],
[theTarget UTF8String],
@@ -172,9 +172,9 @@ - (NSString *)target {
if(![self isValid]) return nil;
if(git_reference_type(self.git_reference) == GIT_REF_OID) {
- return [NSString git_stringWithOid:git_reference_oid(self.git_reference)];
+ return [NSString git_stringWithOid:git_reference_target(self.git_reference)];
} else {
- return [NSString stringWithUTF8String:git_reference_target(self.git_reference)];
+ return [NSString stringWithUTF8String:git_reference_symbolic_target(self.git_reference)];
}
}
@@ -198,9 +198,9 @@ - (BOOL)setTarget:(NSString *)newTarget error:(NSError **)error {
return NO;
}
- gitError = git_reference_set_oid(self.git_reference, &oid);
+ gitError = git_reference_set_target(self.git_reference, &oid);
} else {
- gitError = git_reference_set_target(self.git_reference, [newTarget UTF8String]);
+ gitError = git_reference_symbolic_set_target(self.git_reference, [newTarget UTF8String]);
}
if(gitError < GIT_OK) {
@@ -239,7 +239,7 @@ - (GTReference *)resolvedReferenceWithError:(NSError **)error {
- (const git_oid *)oid {
if(![self isValid]) return NULL;
- return git_reference_oid(self.git_reference);
+ return git_reference_target(self.git_reference);
}
- (BOOL)reloadWithError:(NSError **)error {
View
2 Classes/GTRepository.h
@@ -54,7 +54,7 @@ enum {
typedef unsigned int GTRepositoryFileStatus;
-typedef enum : git_reset_type {
+typedef enum : git_reset_t {
GTRepositoryResetTypeSoft = GIT_RESET_SOFT,
GTRepositoryResetTypeMixed = GIT_RESET_MIXED,
GTRepositoryResetTypeHard = GIT_RESET_HARD
View
2 Classes/GTRepository.m
@@ -538,7 +538,7 @@ - (BOOL)resetToCommit:(GTCommit *)commit withResetType:(GTRepositoryResetType)re
NSParameterAssert(commit != nil);
git_object *targetCommit = commit.git_object;
- int result = git_reset(self.git_repository, targetCommit, (git_reset_type)resetType);
+ int result = git_reset(self.git_repository, targetCommit, (git_reset_t)resetType);
if (result == GIT_OK) return YES;
if (error != NULL) *error = [NSError git_errorFor:result withAdditionalDescription:@"Failed to reset repository."];
View
2 Classes/GTTag.m
@@ -84,7 +84,7 @@ - (GTObject *)target {
}
- (NSString *)targetType {
- return [NSString stringWithUTF8String:git_object_type2string(git_tag_type(self.git_tag))];
+ return [NSString stringWithUTF8String:git_object_type2string(git_tag_target_type(self.git_tag))];
}
- (GTSignature *)tagger {
2 libgit2
@@ -1 +1 @@
-Subproject commit 83885891f583ab447f98f1c7a637f1f507e1be22
+Subproject commit 693021262ba0eeac2923bbce1b2262717019c807

0 comments on commit b5196cb

Please sign in to comment.