PBGitCommitController: Don't allow duplicate Sign-Offs

This prevents signing off a commit-message twice by the same person,
just like git-gui does.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This commit is contained in:
Johannes Gilger
2009-06-13 14:13:33 +02:00
parent 93124387c4
commit dd0822d5cd
+7 -4
View File
@@ -52,11 +52,14 @@
{
if (![repository.config valueForKeyPath:@"user.name"] || ![repository.config valueForKeyPath:@"user.email"])
return [[repository windowController] showMessageSheet:@"User's name not set" infoText:@"Signing off a commit requires setting user.name and user.email in your git config"];
NSString *SOBline = [NSString stringWithFormat:@"Signed-off-by: %@ <%@>",
[repository.config valueForKeyPath:@"user.name"],
[repository.config valueForKeyPath:@"user.email"]];
commitMessageView.string = [NSString stringWithFormat:@"%@\n\nSigned-off-by: %@ <%@>",
commitMessageView.string,
[repository.config valueForKeyPath:@"user.name"],
[repository.config valueForKeyPath:@"user.email"]];
if([commitMessageView.string rangeOfString:SOBline].location == NSNotFound) {
commitMessageView.string = [NSString stringWithFormat:@"%@\n\n%@",
commitMessageView.string, SOBline];
}
}
- (void) setAmend:(BOOL)newAmend