Commit b3d0ba4
Add reset file commands to compare view (#3)
* Add reset file commands to compare view
Enable "Reset to Parent Revision" and "Reset to This Revision" commands
in the compare view when selecting two commits. These commands now work
for both single and multiple file selections in the compare view.
- Add ResetToSourceRevisionAsync and ResetToTargetRevisionAsync methods
- Add ResetMultipleToSourceRevisionAsync and ResetMultipleToTargetRevisionAsync methods
- Update RevisionCompare constructor to accept Repository object for logging
- Add CanResetFiles property to check if reset operations are available
- Add reset menu items to context menu in RevisionCompare view
- Parent Revision resets to compare source (StartPoint)
- Current Revision resets to compare target (EndPoint)
* Fix reset file commands for deleted files in compare view
When resetting a file to a revision where it is deleted, use 'git rm'
instead of 'git checkout' to properly remove the file from both the
working directory and the index.
- Add new Remove command for git rm operations
- Update ResetToSourceRevisionAsync to handle Added files (don't exist in source)
- Update ResetToTargetRevisionAsync to handle Deleted files (don't exist in target)
- Update multiple file reset methods to separate files into checkout vs remove lists
- Pass Change object instead of just path string to enable state checking
- Use --force and --ignore-unmatch flags for robust file removal
Fixes the "pathspec did not match any file(s) known to git" error when
trying to reset deleted files to the revision where they are deleted.
* Apply deleted file fix to single commit view reset commands
Apply the same deleted/added file handling to CommitDetail (single
commit view) that was previously applied to RevisionCompare.
- Update ResetToThisRevisionAsync to handle Deleted files
- Update ResetToParentRevisionAsync to handle Added files
- Update ResetMultipleToThisRevisionAsync to separate deleted files
- Update ResetMultipleToParentRevisionAsync to separate added files
- Change method signature to accept Change object instead of path string
- Update all call sites to pass Change object instead of path
This fixes the same "pathspec did not match any file(s) known to git"
error when resetting deleted files in single commit view.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7cc4f9b commit b3d0ba4
File tree
7 files changed
+275
-18
lines changed- src
- Commands
- ViewModels
- Views
7 files changed
+275
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
254 | 264 | | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
258 | 268 | | |
259 | 269 | | |
260 | 270 | | |
261 | | - | |
262 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
263 | 284 | | |
264 | | - | |
265 | 285 | | |
266 | 286 | | |
267 | 287 | | |
268 | 288 | | |
269 | 289 | | |
270 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
271 | 294 | | |
272 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
273 | 301 | | |
274 | 302 | | |
275 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
276 | 315 | | |
277 | 316 | | |
278 | 317 | | |
279 | 318 | | |
280 | 319 | | |
281 | 320 | | |
282 | | - | |
| 321 | + | |
| 322 | + | |
283 | 323 | | |
| 324 | + | |
284 | 325 | | |
285 | 326 | | |
286 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
287 | 335 | | |
| 336 | + | |
288 | 337 | | |
289 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
290 | 342 | | |
291 | 343 | | |
292 | 344 | | |
293 | 345 | | |
294 | | - | |
295 | | - | |
| 346 | + | |
| 347 | + | |
296 | 348 | | |
297 | 349 | | |
298 | 350 | | |
299 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
300 | 360 | | |
301 | 361 | | |
302 | 362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
80 | 87 | | |
81 | 88 | | |
| 89 | + | |
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
| |||
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
| |||
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
143 | 262 | | |
144 | 263 | | |
145 | 264 | | |
| |||
206 | 325 | | |
207 | 326 | | |
208 | 327 | | |
| 328 | + | |
209 | 329 | | |
210 | 330 | | |
211 | 331 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
0 commit comments