Skip to content

Commit 948a203

Browse files
committed
Strip the last newline from git output
1 parent a197b1c commit 948a203

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Classes/git/PBGitRepository_PBGitBinarySupport.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ - (NSString *)outputOfTaskWithArguments:(NSArray *)arguments input:(NSString *)i
4343
BOOL success = [task launchTask:error];
4444
if (!success) return nil;
4545

46-
return [task standardOutputString];
46+
NSString *output = [task standardOutputString];
47+
/* Strip extraneous \n from output */
48+
if (output.length > 1 && [output characterAtIndex:output.length - 1] == '\n') {
49+
output = [output stringByReplacingCharactersInRange:NSMakeRange(output.length - 1, 1) withString:@""];
50+
}
51+
return output;
4752
}
4853

4954
- (NSString *)outputOfTaskWithArguments:(NSArray *)arguments error:(NSError **)error

0 commit comments

Comments
 (0)