35
35
#import " GTReference.h"
36
36
#import " GTFilterList.h"
37
37
#import " git2/checkout.h"
38
+ #import " git2/repository.h"
38
39
#import " git2/transport.h"
39
40
#import " git2/sys/transport.h"
40
41
@@ -88,22 +89,62 @@ typedef NS_OPTIONS(NSInteger, GTTransportFlags) {
88
89
89
90
// / An `NSNumber` wrapped `GTTransportFlags`, documented above.
90
91
// / Default value is `GTTransportFlagsNone`.
91
- extern NSString *const GTRepositoryCloneOptionsTransportFlags;
92
+ extern NSString * const GTRepositoryCloneOptionsTransportFlags;
92
93
93
94
// / An `NSNumber` wrapped `BOOL`, if YES, create a bare clone.
94
95
// / Default value is `NO`.
95
- extern NSString *const GTRepositoryCloneOptionsBare;
96
+ extern NSString * const GTRepositoryCloneOptionsBare;
96
97
97
98
// / An `NSNumber` wrapped `BOOL`, if NO, don't checkout the remote HEAD.
98
99
// / Default value is `YES`.
99
- extern NSString *const GTRepositoryCloneOptionsCheckout;
100
+ extern NSString * const GTRepositoryCloneOptionsCheckout;
100
101
101
102
// / A `GTCredentialProvider`, that will be used to authenticate against the
102
103
// / remote.
103
- extern NSString *const GTRepositoryCloneOptionsCredentialProvider;
104
+ extern NSString * const GTRepositoryCloneOptionsCredentialProvider;
104
105
105
106
// / A BOOL indicating whether local clones should actually clone, or just link.
106
- extern NSString *const GTRepositoryCloneOptionsCloneLocal;
107
+ extern NSString * const GTRepositoryCloneOptionsCloneLocal;
108
+
109
+ // / Initialization flags associated with `GTRepositoryInitOptionsFlags` for
110
+ // / +initializeEmptyRepositoryAtFileURL:options:error:.
111
+ // /
112
+ // / See `git_repository_init_flag_t` for more information.
113
+ typedef NS_OPTIONS (NSInteger , GTRepositoryInitFlags) {
114
+ GTRepositoryInitBare = GIT_REPOSITORY_INIT_BARE,
115
+ GTRepositoryInitWithoutReinitializing = GIT_REPOSITORY_INIT_NO_REINIT,
116
+ GTRepositoryInitWithoutDotGit = GIT_REPOSITORY_INIT_NO_DOTGIT_DIR,
117
+ GTRepositoryInitCreatingRepositoryDirectory = GIT_REPOSITORY_INIT_MKDIR,
118
+ GTRepositoryInitCreatingIntermediateDirectories = GIT_REPOSITORY_INIT_MKPATH,
119
+ GTRepositoryInitWithExternalTemplate = GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE,
120
+ GTRepositoryInitWithRelativeGitLink = GIT_REPOSITORY_INIT_RELATIVE_GITLINK,
121
+ };
122
+
123
+ // / An `NSNumber` wrapping `GTRepositoryInitFlags` with which to initialize the
124
+ // / repository.
125
+ extern NSString * const GTRepositoryInitOptionsFlags;
126
+
127
+ // / An `NSNumber` wrapping a `mode_t` or `git_repository_init_mode_t` to use
128
+ // / for the initialized repository.
129
+ extern NSString * const GTRepositoryInitOptionsMode;
130
+
131
+ // / An `NSString` to the working directory that should be used. If this is a
132
+ // / relative path, it will be resolved against the repository path.
133
+ extern NSString * const GTRepositoryInitOptionsWorkingDirectoryPath;
134
+
135
+ // / An `NSString` of the Git description to use for the new repository.
136
+ extern NSString * const GTRepositoryInitOptionsDescription;
137
+
138
+ // / A file `NSURL` to the template directory that should be used instead of the
139
+ // / defaults, if the `GTRepositoryInitWithExternalTemplate` flag is specified.
140
+ extern NSString * const GTRepositoryInitOptionsTemplateURL;
141
+
142
+ // / An `NSString` of the name to use for the initial `HEAD` reference.
143
+ extern NSString * const GTRepositoryInitOptionsInitialHEAD;
144
+
145
+ // / An `NSString` representing an origin URL to add to the repository after
146
+ // / initialization.
147
+ extern NSString * const GTRepositoryInitOptionsOriginURLString;
107
148
108
149
@interface GTRepository : NSObject
109
150
@@ -127,19 +168,12 @@ extern NSString *const GTRepositoryCloneOptionsCloneLocal;
127
168
// / Initializes a new repository at the given file URL.
128
169
// /
129
170
// / fileURL - The file URL for the new repository. Cannot be nil.
171
+ // / options - A dictionary of `GTRepositoryInitOptions…` keys controlling how
172
+ // / the repository is initialized, or nil to use the defaults.
130
173
// / error - The error if one occurs.
131
174
// /
132
175
// / Returns the initialized repository, or nil if an error occurred.
133
- + (instancetype )initializeEmptyRepositoryAtFileURL : (NSURL *)fileURL error : (NSError **)error ;
134
-
135
- // / Initializes a new repository at the given file URL.
136
- // /
137
- // / fileURL - The file URL for the new repository. Cannot be nil.
138
- // / error - The error if one occurs.
139
- // / bare - Should the repository be created bare?
140
- // /
141
- // / Returns the initialized repository, or nil if an error occurred.
142
- + (instancetype )initializeEmptyRepositoryAtFileURL : (NSURL *)fileURL bare : (BOOL )bare error : (NSError **)error ;
176
+ + (instancetype )initializeEmptyRepositoryAtFileURL : (NSURL *)fileURL options : (NSDictionary *)options error : (NSError **)error ;
143
177
144
178
+ (id )repositoryWithURL : (NSURL *)localFileURL error : (NSError **)error ;
145
179
- (id )initWithURL : (NSURL *)localFileURL error : (NSError **)error ;
0 commit comments