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