@@ -1406,6 +1406,11 @@ _git_clone ()
1406
1406
;;
1407
1407
esac
1408
1408
case " $cur " in
1409
+ --config=* )
1410
+ __git_complete_config_variable_name_and_value \
1411
+ --cur=" ${cur## --config=} "
1412
+ return
1413
+ ;;
1409
1414
--* )
1410
1415
__gitcomp_builtin clone
1411
1416
return
@@ -2352,84 +2357,97 @@ __git_complete_config_variable_value ()
2352
2357
# Completes configuration sections, subsections, variable names.
2353
2358
#
2354
2359
# Usage: __git_complete_config_variable_name [<option>]...
2360
+ # --cur=<word>: The current configuration section/variable name to be
2361
+ # completed. Defaults to the current word to be completed.
2355
2362
# --sfx=<suffix>: A suffix to be appended to each fully completed
2356
2363
# configuration variable name (but not to sections or
2357
2364
# subsections) instead of the default space.
2358
2365
__git_complete_config_variable_name ()
2359
2366
{
2360
- local sfx
2367
+ local cur_= " $cur " sfx
2361
2368
2362
2369
while test $# ! = 0; do
2363
2370
case " $1 " in
2371
+ --cur=* ) cur_=" ${1## --cur=} " ;;
2364
2372
--sfx=* ) sfx=" ${1## --sfx=} " ;;
2365
2373
* ) return 1 ;;
2366
2374
esac
2367
2375
shift
2368
2376
done
2369
2377
2370
- case " $cur " in
2378
+ case " $cur_ " in
2371
2379
branch.* .* )
2372
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2380
+ local pfx=" ${cur_% .* } ."
2381
+ cur_=" ${cur_##* .} "
2373
2382
__gitcomp " remote pushRemote merge mergeOptions rebase" " $pfx " " $cur_ " " $sfx "
2374
2383
return
2375
2384
;;
2376
2385
branch.* )
2377
- local pfx=" ${cur% .* } ." cur_=" ${cur#* .} "
2386
+ local pfx=" ${cur% .* } ."
2387
+ cur_=" ${cur#* .} "
2378
2388
__gitcomp_direct " $( __git_heads " $pfx " " $cur_ " " ." ) "
2379
2389
__gitcomp_nl_append $' autoSetupMerge\n autoSetupRebase\n ' " $pfx " " $cur_ " " $sfx "
2380
2390
return
2381
2391
;;
2382
2392
guitool.* .* )
2383
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2393
+ local pfx=" ${cur_% .* } ."
2394
+ cur_=" ${cur_##* .} "
2384
2395
__gitcomp "
2385
2396
argPrompt cmd confirm needsFile noConsole noRescan
2386
2397
prompt revPrompt revUnmerged title
2387
2398
" " $pfx " " $cur_ " " $sfx "
2388
2399
return
2389
2400
;;
2390
2401
difftool.* .* )
2391
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2402
+ local pfx=" ${cur_% .* } ."
2403
+ cur_=" ${cur_##* .} "
2392
2404
__gitcomp " cmd path" " $pfx " " $cur_ " " $sfx "
2393
2405
return
2394
2406
;;
2395
2407
man.* .* )
2396
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2408
+ local pfx=" ${cur_% .* } ."
2409
+ cur_=" ${cur_##* .} "
2397
2410
__gitcomp " cmd path" " $pfx " " $cur_ " " $sfx "
2398
2411
return
2399
2412
;;
2400
2413
mergetool.* .* )
2401
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2414
+ local pfx=" ${cur_% .* } ."
2415
+ cur_=" ${cur_##* .} "
2402
2416
__gitcomp " cmd path trustExitCode" " $pfx " " $cur_ " " $sfx "
2403
2417
return
2404
2418
;;
2405
2419
pager.* )
2406
- local pfx=" ${cur% .* } ." cur_=" ${cur#* .} "
2420
+ local pfx=" ${cur_% .* } ."
2421
+ cur_=" ${cur_#* .} "
2407
2422
__git_compute_all_commands
2408
2423
__gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " $sfx "
2409
2424
return
2410
2425
;;
2411
2426
remote.* .* )
2412
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2427
+ local pfx=" ${cur_% .* } ."
2428
+ cur_=" ${cur_##* .} "
2413
2429
__gitcomp "
2414
2430
url proxy fetch push mirror skipDefaultUpdate
2415
2431
receivepack uploadpack tagOpt pushurl
2416
2432
" " $pfx " " $cur_ " " $sfx "
2417
2433
return
2418
2434
;;
2419
2435
remote.* )
2420
- local pfx=" ${cur% .* } ." cur_=" ${cur#* .} "
2436
+ local pfx=" ${cur_% .* } ."
2437
+ cur_=" ${cur_#* .} "
2421
2438
__gitcomp_nl " $( __git_remotes) " " $pfx " " $cur_ " " ."
2422
2439
__gitcomp_nl_append " pushDefault" " $pfx " " $cur_ " " $sfx "
2423
2440
return
2424
2441
;;
2425
2442
url.* .* )
2426
- local pfx=" ${cur% .* } ." cur_=" ${cur##* .} "
2443
+ local pfx=" ${cur_% .* } ."
2444
+ cur_=" ${cur_##* .} "
2427
2445
__gitcomp " insteadOf pushInsteadOf" " $pfx " " $cur_ " " $sfx "
2428
2446
return
2429
2447
;;
2430
2448
* .* )
2431
2449
__git_compute_config_vars
2432
- __gitcomp " $__git_config_vars " " " " $cur " " $sfx "
2450
+ __gitcomp " $__git_config_vars " " " " $cur_ " " $sfx "
2433
2451
;;
2434
2452
* )
2435
2453
__git_compute_config_vars
@@ -2441,22 +2459,36 @@ __git_complete_config_variable_name ()
2441
2459
for (s in sections)
2442
2460
print s "."
2443
2461
}
2444
- ' ) "
2462
+ ' ) " " " " $cur_ "
2445
2463
;;
2446
2464
esac
2447
2465
}
2448
2466
2449
2467
# Completes '='-separated configuration sections/variable names and values
2450
2468
# for 'git -c section.name=value'.
2469
+ #
2470
+ # Usage: __git_complete_config_variable_name_and_value [<option>]...
2471
+ # --cur=<word>: The current configuration section/variable name/value to be
2472
+ # completed. Defaults to the current word to be completed.
2451
2473
__git_complete_config_variable_name_and_value ()
2452
2474
{
2453
- case " $cur " in
2475
+ local cur_=" $cur "
2476
+
2477
+ while test $# ! = 0; do
2478
+ case " $1 " in
2479
+ --cur=* ) cur_=" ${1## --cur=} " ;;
2480
+ * ) return 1 ;;
2481
+ esac
2482
+ shift
2483
+ done
2484
+
2485
+ case " $cur_ " in
2454
2486
* =* )
2455
2487
__git_complete_config_variable_value \
2456
- --varname=" ${cur %% =* } " --cur=" ${cur #* =} "
2488
+ --varname=" ${cur_ %% =* } " --cur=" ${cur_ #* =} "
2457
2489
;;
2458
2490
* )
2459
- __git_complete_config_variable_name --sfx=' ='
2491
+ __git_complete_config_variable_name --cur= " $cur_ " -- sfx=' ='
2460
2492
;;
2461
2493
esac
2462
2494
}
0 commit comments