@@ -294,6 +294,9 @@ static int checkout_action_no_wd(
294
294
295
295
* action = CHECKOUT_ACTION__NONE ;
296
296
297
+ if ((data -> strategy & GIT_CHECKOUT_NONE ))
298
+ return 0 ;
299
+
297
300
switch (delta -> status ) {
298
301
case GIT_DELTA_UNMODIFIED : /* case 12 */
299
302
error = checkout_notify (data , GIT_CHECKOUT_NOTIFY_DIRTY , delta , NULL );
@@ -302,17 +305,17 @@ static int checkout_action_no_wd(
302
305
* action = CHECKOUT_ACTION_IF (RECREATE_MISSING , UPDATE_BLOB , NONE );
303
306
break ;
304
307
case GIT_DELTA_ADDED : /* case 2 or 28 (and 5 but not really) */
305
- * action = CHECKOUT_ACTION_IF ( SAFE , UPDATE_BLOB , NONE ) ;
308
+ * action = CHECKOUT_ACTION__UPDATE_BLOB ;
306
309
break ;
307
310
case GIT_DELTA_MODIFIED : /* case 13 (and 35 but not really) */
308
311
* action = CHECKOUT_ACTION_IF (RECREATE_MISSING , UPDATE_BLOB , CONFLICT );
309
312
break ;
310
313
case GIT_DELTA_TYPECHANGE : /* case 21 (B->T) and 28 (T->B)*/
311
314
if (delta -> new_file .mode == GIT_FILEMODE_TREE )
312
- * action = CHECKOUT_ACTION_IF ( SAFE , UPDATE_BLOB , NONE ) ;
315
+ * action = CHECKOUT_ACTION__UPDATE_BLOB ;
313
316
break ;
314
317
case GIT_DELTA_DELETED : /* case 8 or 25 */
315
- * action = CHECKOUT_ACTION_IF ( SAFE , REMOVE , NONE ) ;
318
+ * action = CHECKOUT_ACTION__REMOVE ;
316
319
break ;
317
320
default : /* impossible */
318
321
break ;
@@ -494,6 +497,9 @@ static int checkout_action_with_wd(
494
497
{
495
498
* action = CHECKOUT_ACTION__NONE ;
496
499
500
+ if ((data -> strategy & GIT_CHECKOUT_NONE ))
501
+ return 0 ;
502
+
497
503
switch (delta -> status ) {
498
504
case GIT_DELTA_UNMODIFIED : /* case 14/15 or 33 */
499
505
if (checkout_is_workdir_modified (data , & delta -> old_file , & delta -> new_file , wd )) {
@@ -512,28 +518,28 @@ static int checkout_action_with_wd(
512
518
if (checkout_is_workdir_modified (data , & delta -> old_file , & delta -> new_file , wd ))
513
519
* action = CHECKOUT_ACTION_IF (FORCE , REMOVE , CONFLICT );
514
520
else
515
- * action = CHECKOUT_ACTION_IF ( SAFE , REMOVE , NONE ) ;
521
+ * action = CHECKOUT_ACTION__REMOVE ;
516
522
break ;
517
523
case GIT_DELTA_MODIFIED : /* case 16, 17, 18 (or 36 but not really) */
518
524
if (wd -> mode != GIT_FILEMODE_COMMIT &&
519
525
checkout_is_workdir_modified (data , & delta -> old_file , & delta -> new_file , wd ))
520
526
* action = CHECKOUT_ACTION_IF (FORCE , UPDATE_BLOB , CONFLICT );
521
527
else
522
- * action = CHECKOUT_ACTION_IF ( SAFE , UPDATE_BLOB , NONE ) ;
528
+ * action = CHECKOUT_ACTION__UPDATE_BLOB ;
523
529
break ;
524
530
case GIT_DELTA_TYPECHANGE : /* case 22, 23, 29, 30 */
525
531
if (delta -> old_file .mode == GIT_FILEMODE_TREE ) {
526
532
if (wd -> mode == GIT_FILEMODE_TREE )
527
533
/* either deleting items in old tree will delete the wd dir,
528
534
* or we'll get a conflict when we attempt blob update...
529
535
*/
530
- * action = CHECKOUT_ACTION_IF ( SAFE , UPDATE_BLOB , NONE ) ;
536
+ * action = CHECKOUT_ACTION__UPDATE_BLOB ;
531
537
else if (wd -> mode == GIT_FILEMODE_COMMIT ) {
532
538
/* workdir is possibly a "phantom" submodule - treat as a
533
539
* tree if the only submodule info came from the config
534
540
*/
535
541
if (submodule_is_config_only (data , wd -> path ))
536
- * action = CHECKOUT_ACTION_IF ( SAFE , UPDATE_BLOB , NONE ) ;
542
+ * action = CHECKOUT_ACTION__UPDATE_BLOB ;
537
543
else
538
544
* action = CHECKOUT_ACTION_IF (FORCE , REMOVE_AND_UPDATE , CONFLICT );
539
545
} else
@@ -542,7 +548,7 @@ static int checkout_action_with_wd(
542
548
else if (checkout_is_workdir_modified (data , & delta -> old_file , & delta -> new_file , wd ))
543
549
* action = CHECKOUT_ACTION_IF (FORCE , REMOVE_AND_UPDATE , CONFLICT );
544
550
else
545
- * action = CHECKOUT_ACTION_IF ( SAFE , REMOVE_AND_UPDATE , NONE ) ;
551
+ * action = CHECKOUT_ACTION__REMOVE_AND_UPDATE ;
546
552
547
553
/* don't update if the typechange is to a tree */
548
554
if (delta -> new_file .mode == GIT_FILEMODE_TREE )
@@ -563,6 +569,9 @@ static int checkout_action_with_wd_blocker(
563
569
{
564
570
* action = CHECKOUT_ACTION__NONE ;
565
571
572
+ if ((data -> strategy & GIT_CHECKOUT_NONE ))
573
+ return 0 ;
574
+
566
575
switch (delta -> status ) {
567
576
case GIT_DELTA_UNMODIFIED :
568
577
/* should show delta as dirty / deleted */
@@ -597,6 +606,9 @@ static int checkout_action_with_wd_dir(
597
606
{
598
607
* action = CHECKOUT_ACTION__NONE ;
599
608
609
+ if ((data -> strategy & GIT_CHECKOUT_NONE ))
610
+ return 0 ;
611
+
600
612
switch (delta -> status ) {
601
613
case GIT_DELTA_UNMODIFIED : /* case 19 or 24 (or 34 but not really) */
602
614
GIT_ERROR_CHECK_ERROR (
@@ -627,7 +639,7 @@ static int checkout_action_with_wd_dir(
627
639
* directory if is it left empty, so we can defer removing the
628
640
* dir and it will succeed if no children are left.
629
641
*/
630
- * action = CHECKOUT_ACTION_IF ( SAFE , UPDATE_BLOB , NONE ) ;
642
+ * action = CHECKOUT_ACTION__UPDATE_BLOB ;
631
643
}
632
644
else if (delta -> new_file .mode != GIT_FILEMODE_TREE )
633
645
/* For typechange to dir, dir is already created so no action */
@@ -2433,14 +2445,12 @@ static int checkout_data_init(
2433
2445
2434
2446
/* if you are forcing, allow all safe updates, plus recreate missing */
2435
2447
if ((data -> opts .checkout_strategy & GIT_CHECKOUT_FORCE ) != 0 )
2436
- data -> opts .checkout_strategy |= GIT_CHECKOUT_SAFE |
2437
- GIT_CHECKOUT_RECREATE_MISSING ;
2448
+ data -> opts .checkout_strategy |= GIT_CHECKOUT_RECREATE_MISSING ;
2438
2449
2439
2450
/* if the repository does not actually have an index file, then this
2440
2451
* is an initial checkout (perhaps from clone), so we allow safe updates
2441
2452
*/
2442
- if (!data -> index -> on_disk &&
2443
- (data -> opts .checkout_strategy & GIT_CHECKOUT_SAFE ) != 0 )
2453
+ if (!data -> index -> on_disk )
2444
2454
data -> opts .checkout_strategy |= GIT_CHECKOUT_RECREATE_MISSING ;
2445
2455
2446
2456
data -> strategy = data -> opts .checkout_strategy ;
0 commit comments