Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fetch the config from the repo

  • Loading branch information...
commit 1bff68a40882fba6f9fff1d3cc1e038687174d1f 1 parent fbf8ff7
@joshaber joshaber authored
Showing with 19 additions and 0 deletions.
  1. +2 −0  Classes/GTRepository.h
  2. +17 −0 Classes/GTRepository.m
View
2  Classes/GTRepository.h
@@ -37,6 +37,7 @@
@class GTCommit;
@class GTIndex;
@class GTBranch;
+@class GTConfiguration;
@interface GTRepository : NSObject <GTObject> {}
@@ -46,6 +47,7 @@
@property (nonatomic, readonly, strong) GTEnumerator *enumerator; // should only be used on the main thread
@property (nonatomic, readonly, strong) GTIndex *index;
@property (nonatomic, readonly, strong) GTObjectDatabase *objectDatabase;
+@property (nonatomic, readonly, strong) GTConfiguration *configuration;
@property (nonatomic, readonly, getter=isBare) BOOL bare; // Is this a 'bare' repository? i.e. created with git clone --bare
@property (nonatomic, readonly, getter=isEmpty) BOOL empty; // Is this repository empty? Will only be YES for a freshly `git init`'d repo.
@property (nonatomic, readonly, getter=isHeadDetached) BOOL headDetached; // Is HEAD detached? i.e., not pointing to any permanent ref.
View
17 Classes/GTRepository.m
@@ -37,6 +37,7 @@
#import "GTTag.h"
#import "NSError+Git.h"
#import "NSString+Git.h"
+#import "GTConfiguration.h"
@interface GTRepository ()
@property (nonatomic, assign) git_repository *git_repository;
@@ -45,6 +46,7 @@ @interface GTRepository ()
@property (nonatomic, strong) GTIndex *index;
@property (nonatomic, strong) GTObjectDatabase *objectDatabase;
@property (nonatomic, strong) NSMutableSet *weakEnumerators;
+@property (nonatomic, strong) GTConfiguration *configuration;
@end
@@ -119,6 +121,7 @@ + (id)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error {
@synthesize index;
@synthesize objectDatabase;
@synthesize weakEnumerators;
+@synthesize configuration;
- (id)initWithURL:(NSURL *)localFileURL error:(NSError **)error {
localFileURL = [[self class] _gitURLForURL:localFileURL error:error];
@@ -463,6 +466,20 @@ - (NSMutableSet *)weakEnumerators {
return weakEnumerators;
}
+- (GTConfiguration *)configuration {
+ if(configuration == nil) {
+ git_config *config = NULL;
+ int error = git_repository_config(&config, self.git_repository);
+ if(error < GIT_SUCCESS) {
+
+ }
+
+ self.configuration = [GTConfiguration configurationWithConfiguration:config];
+ }
+
+ return configuration;
+}
+
@end
Please sign in to comment.
Something went wrong with that request. Please try again.