@@ -110,21 +110,6 @@ - (NSDragOperation)tableView:(NSTableView*)tv
110
110
return NSDragOperationNone;
111
111
}
112
112
113
- - (void ) dropRef : (NSDictionary *)dropInfo
114
- {
115
- PBGitRef *ref = [dropInfo objectForKey: @" dragRef" ];
116
- PBGitCommit *oldCommit = [dropInfo objectForKey: @" oldCommit" ];
117
- PBGitCommit *dropCommit = [dropInfo objectForKey: @" dropCommit" ];
118
- if (!ref || ! oldCommit || !dropCommit)
119
- return ;
120
-
121
- if (![historyController.repository updateReference: ref toPointAtCommit: dropCommit])
122
-
123
- [dropCommit addRef: ref];
124
- [oldCommit removeRef: ref];
125
- [historyController.commitList reloadData ];
126
- }
127
-
128
113
- (BOOL )tableView : (NSTableView *)aTableView
129
114
acceptDrop : (id <NSDraggingInfo >)info
130
115
row : (NSInteger )row
@@ -149,17 +134,6 @@ - (BOOL)tableView:(NSTableView *)aTableView
149
134
150
135
PBGitCommit *dropCommit = [[commitController arrangedObjects ] objectAtIndex: row];
151
136
152
- NSDictionary *dropInfo = [NSDictionary dictionaryWithObjectsAndKeys:
153
- ref, @" dragRef" ,
154
- oldCommit, @" oldCommit" ,
155
- dropCommit, @" dropCommit" ,
156
- nil ];
157
-
158
- if ([PBGitDefaults isDialogWarningSuppressedForDialog: kDialogAcceptDroppedRef ]) {
159
- [self dropRef: dropInfo];
160
- return YES ;
161
- }
162
-
163
137
NSString *subject = [dropCommit subject ];
164
138
if ([subject length ] > 99 )
165
139
subject = [[subject substringToIndex: 99 ] stringByAppendingString: @" …" ];
@@ -168,19 +142,22 @@ - (BOOL)tableView:(NSTableView *)aTableView
168
142
alert.messageText = [NSString stringWithFormat: NSLocalizedString(@" Move %@ : %@ " , @" " ), [ref refishType ], [ref shortName ]];
169
143
alert.informativeText = [NSString stringWithFormat: NSLocalizedString(@" Move the %@ to point to the commit: %@ " , @" " ), [ref refishType ], subject];
170
144
171
- [alert addButtonWithTitle: @" Move" ];
172
- [alert addButtonWithTitle: @" Cancel" ];
173
- [alert setShowsSuppressionButton: YES ];
174
-
175
- [alert beginSheetModalForWindow: historyController.windowController.window
176
- completionHandler: ^(NSModalResponse returnCode) {
177
- if (returnCode == NSAlertFirstButtonReturn ) {
178
- [self dropRef: dropInfo];
179
- }
180
-
181
- if ([[alert suppressionButton ] state ] == NSOnState )
182
- [PBGitDefaults suppressDialogWarningForDialog: kDialogAcceptDroppedRef ];
183
- }];
145
+ [alert addButtonWithTitle: NSLocalizedString(@" Move" , @" Move branch label - default button" )];
146
+ [alert addButtonWithTitle: NSLocalizedString(@" Cancel" , @" Move branch label - cancel button" )];
147
+
148
+ PBGitWindowController *wc = historyController.windowController ;
149
+ [wc confirmDialog: alert
150
+ suppressionIdentifier: kDialogAcceptDroppedRef
151
+ forAction: ^{
152
+ NSError *error = nil ;
153
+ if (![wc.repository updateReference: ref toPointAtCommit: dropCommit error: &error]) {
154
+ [wc showErrorSheet: error];
155
+ return ;
156
+ }
157
+
158
+ [dropCommit addRef: ref];
159
+ [oldCommit removeRef: ref];
160
+ }];
184
161
185
162
return YES ;
186
163
}
0 commit comments