-
Notifications
You must be signed in to change notification settings - Fork 280
/
Copy pathGTMerge.h
72 lines (51 loc) · 2.31 KB
/
GTMerge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// GTMerge.h
// ObjectiveGitFramework
//
// Created by Etienne on 26/10/2018.
// Copyright © 2018 GitHub, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "git2/merge.h"
NS_ASSUME_NONNULL_BEGIN
/// Represents the result of a merge
@interface GTMergeResult : NSObject
/// Was the merge automerable ?
@property (readonly,getter=isAutomergeable) BOOL automergeable;
/// The path of the resulting merged file, nil in case of conflicts
@property (readonly) NSString * _Nullable path;
/// The resulting mode of the merged file
@property (readonly) unsigned int mode;
/// The contents of the resulting merged file
@property (readonly) NSData *data;
/// Initialize the merge result from a libgit2 struct.
/// Ownership of the memory will be transferred to the receiver.
- (instancetype)initWithGitMergeFileResult:(git_merge_file_result *)result;
- (instancetype)init NS_UNAVAILABLE;
@end
/// Represents inputs for a tentative merge
@interface GTMergeFile : NSObject
/// The file data
@property (readonly) NSData *data;
/// The file path. Can be nil to not merge paths.
@property (readonly) NSString * _Nullable path;
/// The file mode. Can be 0 to not merge modes.
@property (readonly) unsigned int mode;
/// Perform a merge between files
///
/// ancestorFile - The file to consider the ancestor
/// ourFile - The file to consider as our version
/// theirFile - The file to consider as the incoming version
/// options - The options of the merge. Can be nil.
/// error - A pointer to an error object. Can be NULL.
///
/// Returns the result of the merge, or nil if an error occurred.
+ (GTMergeResult * _Nullable)performMergeWithAncestor:(GTMergeFile *)ancestorFile ourFile:(GTMergeFile *)ourFile theirFile:(GTMergeFile *)theirFile options:(NSDictionary * _Nullable)options error:(NSError **)error;
+ (instancetype)fileWithString:(NSString *)string path:(NSString * _Nullable)path mode:(unsigned int)mode;
/// Initialize an input file for a merge
- (instancetype)initWithData:(NSData *)data path:(NSString * _Nullable)path mode:(unsigned int)mode NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
/// Inner pointer to a libgit2-compatible git_merge_file_input struct.
- (git_merge_file_input *)git_merge_file_input __attribute__((objc_returns_inner_pointer));
@end
NS_ASSUME_NONNULL_END