@@ -1508,6 +1508,22 @@ _git_checkout ()
1508
1508
{
1509
1509
__git_has_doubledash && return
1510
1510
1511
+ local dwim_opt=" $( __git_checkout_default_dwim_mode) "
1512
+
1513
+ case " $prev " in
1514
+ -b|-B|--orphan)
1515
+ # Complete local branches (and DWIM branch
1516
+ # remote branch names) for an option argument
1517
+ # specifying a new branch name. This is for
1518
+ # convenience, assuming new branches are
1519
+ # possibly based on pre-existing branch names.
1520
+ __git_complete_refs $dwim_opt --mode=" heads"
1521
+ return
1522
+ ;;
1523
+ * )
1524
+ ;;
1525
+ esac
1526
+
1511
1527
case " $cur " in
1512
1528
--conflict=* )
1513
1529
__gitcomp " diff3 merge" " " " ${cur## --conflict=} "
@@ -1516,23 +1532,6 @@ _git_checkout ()
1516
1532
__gitcomp_builtin checkout
1517
1533
;;
1518
1534
* )
1519
- local dwim_opt=" $( __git_checkout_default_dwim_mode) "
1520
- local prevword prevword=" ${words[cword-1]} "
1521
-
1522
- case " $prevword " in
1523
- -b|-B|--orphan)
1524
- # Complete local branches (and DWIM branch
1525
- # remote branch names) for an option argument
1526
- # specifying a new branch name. This is for
1527
- # convenience, assuming new branches are
1528
- # possibly based on pre-existing branch names.
1529
- __git_complete_refs $dwim_opt --mode=" heads"
1530
- return
1531
- ;;
1532
- * )
1533
- ;;
1534
- esac
1535
-
1536
1535
# At this point, we've already handled special completion for
1537
1536
# the arguments to -b/-B, and --orphan. There are 3 main
1538
1537
# things left we can possibly complete:
@@ -2392,6 +2391,22 @@ _git_status ()
2392
2391
2393
2392
_git_switch ()
2394
2393
{
2394
+ local dwim_opt=" $( __git_checkout_default_dwim_mode) "
2395
+
2396
+ case " $prev " in
2397
+ -c|-C|--orphan)
2398
+ # Complete local branches (and DWIM branch
2399
+ # remote branch names) for an option argument
2400
+ # specifying a new branch name. This is for
2401
+ # convenience, assuming new branches are
2402
+ # possibly based on pre-existing branch names.
2403
+ __git_complete_refs $dwim_opt --mode=" heads"
2404
+ return
2405
+ ;;
2406
+ * )
2407
+ ;;
2408
+ esac
2409
+
2395
2410
case " $cur " in
2396
2411
--conflict=* )
2397
2412
__gitcomp " diff3 merge" " " " ${cur## --conflict=} "
@@ -2400,23 +2415,6 @@ _git_switch ()
2400
2415
__gitcomp_builtin switch
2401
2416
;;
2402
2417
* )
2403
- local dwim_opt=" $( __git_checkout_default_dwim_mode) "
2404
- local prevword prevword=" ${words[cword-1]} "
2405
-
2406
- case " $prevword " in
2407
- -c|-C|--orphan)
2408
- # Complete local branches (and DWIM branch
2409
- # remote branch names) for an option argument
2410
- # specifying a new branch name. This is for
2411
- # convenience, assuming new branches are
2412
- # possibly based on pre-existing branch names.
2413
- __git_complete_refs $dwim_opt --mode=" heads"
2414
- return
2415
- ;;
2416
- * )
2417
- ;;
2418
- esac
2419
-
2420
2418
# Unlike in git checkout, git switch --orphan does not take
2421
2419
# a start point. Thus we really have nothing to complete after
2422
2420
# the branch name.
@@ -2843,6 +2841,13 @@ _git_reset ()
2843
2841
2844
2842
_git_restore ()
2845
2843
{
2844
+ case " $prev " in
2845
+ -s)
2846
+ __git_complete_refs
2847
+ return
2848
+ ;;
2849
+ esac
2850
+
2846
2851
case " $cur " in
2847
2852
--conflict=* )
2848
2853
__gitcomp " diff3 merge" " " " ${cur## --conflict=} "
0 commit comments