mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
CommitController: Don't rewrap commit message when amending
We used to use git log with a custom pretty command to reread the commit message, but this rewraps the subject line, and also adds extra newlines. We fix this by reading in the raw commit from git-cat-file, and then searching for the double newline.
This commit is contained in:
+11
-2
@@ -44,8 +44,17 @@
|
||||
return;
|
||||
amend = newAmend;
|
||||
|
||||
if (amend && [[commitMessageView string] length] <= 3)
|
||||
commitMessageView.string = [repository outputForCommand:@"log -1 --pretty=format:%s%n%n%b HEAD"];
|
||||
// Replace commit message with the old one if it's less than 3 characters long.
|
||||
// This is just a random number.
|
||||
if (amend && [[commitMessageView string] length] <= 3) {
|
||||
NSString *message = [repository outputForCommand:@"cat-file commit HEAD"];
|
||||
NSRange r = [message rangeOfString:@"\n\n"];
|
||||
if (r.location != NSNotFound)
|
||||
message = [message substringFromIndex:r.location + 2];
|
||||
|
||||
commitMessageView.string = message;
|
||||
}
|
||||
|
||||
|
||||
[self refresh:self];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user