mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
PBRefController: Ask for confirmation when deleting tags/branches
Show a very simple user-dialog when trying to delete a branch or a tag. This satisfies ticket #115. Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This commit is contained in:
committed by
Pieter de Bie
parent
48b0fc8456
commit
49a21e655f
+15
-8
@@ -37,15 +37,22 @@
|
||||
|
||||
- (void) removeRef:(PBRefMenuItem *) sender
|
||||
{
|
||||
int ret = 1;
|
||||
[historyController.repository outputForArguments:[NSArray arrayWithObjects:@"update-ref", @"-d", [[sender ref] ref], nil] retValue: &ret];
|
||||
if (ret) {
|
||||
NSLog(@"Removing ref failed!");
|
||||
return;
|
||||
}
|
||||
NSString *ref_desc = [NSString stringWithFormat:@"%@ %@", [[sender ref] type], [[sender ref] shortName]];
|
||||
NSString *question = [NSString stringWithFormat:@"Are you sure you want to remove the %@?", ref_desc];
|
||||
int choice = NSRunAlertPanel([NSString stringWithFormat:@"Delete %@?", ref_desc], question, @"Delete", @"Cancel", nil);
|
||||
// TODO: Use a non-modal alert here, so we don't block all the GitX windows
|
||||
|
||||
[[sender commit] removeRef:[sender ref]];
|
||||
[commitController rearrangeObjects];
|
||||
if(choice) {
|
||||
int ret = 1;
|
||||
[historyController.repository outputForArguments:[NSArray arrayWithObjects:@"update-ref", @"-d", [[sender ref] ref], nil] retValue: &ret];
|
||||
if (ret) {
|
||||
NSLog(@"Removing ref failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
[[sender commit] removeRef:[sender ref]];
|
||||
[commitController rearrangeObjects];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) checkoutRef:(PBRefMenuItem *)sender
|
||||
|
||||
Reference in New Issue
Block a user