Skip to content

Commit 502f218

Browse files
committed
Merge pull request brotherbard#56 from nerdrew/master
Enable multiline git config values.
2 parents 52b587a + 1f73579 commit 502f218

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

PBGitConfig.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,20 @@ - (NSDictionary*) listConfigValuesInDir:(NSString*)inDir
9999
NSArray* arguments;
100100

101101
if (inDir == nil) {
102-
arguments = [NSArray arrayWithObjects:@"config", @"--global", @"-l", nil];
102+
arguments = [NSArray arrayWithObjects:@"config", @"--global", @"-l", @"-z", nil];
103103
} else {
104-
arguments = [NSArray arrayWithObjects:@"config", @"-l", nil];
104+
arguments = [NSArray arrayWithObjects:@"config", @"-l", @"-z", nil];
105105
}
106106

107107
int ret = 1;
108108
NSString* output = [PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:arguments inDir:inDir retValue:&ret];
109109
NSMutableDictionary *result = [NSMutableDictionary dictionary];
110110
if (ret==0) {
111-
NSArray *lines = [output componentsSeparatedByString:@"\n"];
112-
111+
NSArray *lines = [output componentsSeparatedByString:@"\0"];
112+
113113
for (NSString* line in lines) {
114-
NSRange equalsPos = [line rangeOfString:@"="];
114+
if([line length] == 0) continue;
115+
NSRange equalsPos = [line rangeOfString:@"\n"];
115116
NSString* key = [line substringToIndex:equalsPos.location];
116117
NSString* value = [line substringFromIndex:equalsPos.location+1];
117118
[result setObject:value forKey:key];

0 commit comments

Comments
 (0)