From fd146bd44b6ae43ace3553c593f556eb77bb95b3 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Wed, 8 Oct 2008 22:59:27 +0200 Subject: [PATCH] CommitView: Add a better reflog entry This adds an entry in the form of commit: CommitView: Add a better reflog entry to the reflog upon commit, rather than Commit from GitX which isn't very informative --- PBGitCommitController.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index e1524a8..24d6937 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -221,7 +221,14 @@ informativeTextWithFormat:@"Please enter a commit message before committing"] runModal]; return; } + + NSString *commitSubject = [commitMessage substringToIndex: + [commitMessage rangeOfString:@"\n"].location]; + if (!commitSubject) + commitSubject = commitMessage; + commitSubject = [@"commit: " stringByAppendingString:commitSubject]; + self.busy++; self.status = @"Creating tree.."; NSString *tree = [repository outputForCommand:@"write-tree"]; @@ -243,7 +250,7 @@ if (ret || [commit length] != 40) return [self commitFailedBecause:@"Could not create a commit object"]; - [repository outputForArguments:[NSArray arrayWithObjects:@"update-ref", @"-m", @"Commit from GitX", @"HEAD", commit, nil] + [repository outputForArguments:[NSArray arrayWithObjects:@"update-ref", @"-m", commitSubject, @"HEAD", commit, nil] retValue: &ret]; if (ret) return [self commitFailedBecause:@"Could not update HEAD"];