From b753ab09e572f2cdcad05b9e62f00d1bf378d927 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Sun, 28 Sep 2008 21:25:53 +0200 Subject: [PATCH] CommitView: Don't allow empty commits --- PBGitCommitController.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index a8e6faf..24f275b 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -167,7 +167,15 @@ - (IBAction) commit:(id) sender { - + if ([[cachedFilesController arrangedObjects] count] == 0) { + [[NSAlert alertWithMessageText:@"No changes to commit" + defaultButton:nil + alternateButton:nil + otherButton:nil + informativeTextWithFormat:@"You must first stage some changes before committing"] runModal]; + return; + } + NSString *commitMessage = [commitMessageView string]; if ([commitMessage length] < 3) { [[NSAlert alertWithMessageText:@"Commitmessage missing" @@ -177,7 +185,7 @@ informativeTextWithFormat:@"Please enter a commit message before committing"] runModal]; return; } - + self.busy++; self.status = @"Creating tree.."; NSString *tree = [repository outputForCommand:@"write-tree"];