@@ -2229,96 +2229,112 @@ __git_compute_config_vars ()
2229
2229
}
2230
2230
2231
2231
# Completes possible values of various configuration variables.
2232
+ #
2233
+ # Usage: __git_complete_config_variable_value [<option>]...
2234
+ # --varname=<word>: The name of the configuration variable whose value is
2235
+ # to be completed. Defaults to the previous word on the
2236
+ # command line.
2237
+ # --cur=<word>: The current value to be completed. Defaults to the current
2238
+ # word to be completed.
2232
2239
__git_complete_config_variable_value ()
2233
2240
{
2234
- local varname
2241
+ local varname=" $prev " cur_=" $cur "
2242
+
2243
+ while test $# ! = 0; do
2244
+ case " $1 " in
2245
+ --varname=* ) varname=" ${1## --varname=} " ;;
2246
+ --cur=* ) cur_=" ${1## --cur=} " ;;
2247
+ * ) return 1 ;;
2248
+ esac
2249
+ shift
2250
+ done
2235
2251
2236
2252
if [ " ${BASH_VERSINFO[0]:- 0} " -ge 4 ]; then
2237
- varname=" ${prev ,,} "
2253
+ varname=" ${varname ,,} "
2238
2254
else
2239
- varname=" $( echo " $prev " | tr A-Z a-z) "
2255
+ varname=" $( echo " $varname " | tr A-Z a-z) "
2240
2256
fi
2241
2257
2242
2258
case " $varname " in
2243
2259
branch.* .remote|branch.* .pushremote)
2244
- __gitcomp_nl " $( __git_remotes) "
2260
+ __gitcomp_nl " $( __git_remotes) " " " " $cur_ "
2245
2261
return
2246
2262
;;
2247
2263
branch.* .merge)
2248
- __git_complete_refs
2264
+ __git_complete_refs --cur= " $cur_ "
2249
2265
return
2250
2266
;;
2251
2267
branch.* .rebase)
2252
- __gitcomp " false true merges preserve interactive"
2268
+ __gitcomp " false true merges preserve interactive" " " " $cur_ "
2253
2269
return
2254
2270
;;
2255
2271
remote.pushdefault)
2256
- __gitcomp_nl " $( __git_remotes) "
2272
+ __gitcomp_nl " $( __git_remotes) " " " " $cur_ "
2257
2273
return
2258
2274
;;
2259
2275
remote.* .fetch)
2260
- local remote=" ${prev # remote.} "
2276
+ local remote=" ${varname # remote.} "
2261
2277
remote=" ${remote% .fetch} "
2262
- if [ -z " $cur " ]; then
2278
+ if [ -z " $cur_ " ]; then
2263
2279
__gitcomp_nl " refs/heads/" " " " " " "
2264
2280
return
2265
2281
fi
2266
- __gitcomp_nl " $( __git_refs_remotes " $remote " ) "
2282
+ __gitcomp_nl " $( __git_refs_remotes " $remote " ) " " " " $cur_ "
2267
2283
return
2268
2284
;;
2269
2285
remote.* .push)
2270
- local remote=" ${prev # remote.} "
2286
+ local remote=" ${varname # remote.} "
2271
2287
remote=" ${remote% .push} "
2272
2288
__gitcomp_nl " $( __git for-each-ref \
2273
- --format=' %(refname):%(refname)' refs/heads) "
2289
+ --format=' %(refname):%(refname)' refs/heads) " " " " $cur_ "
2274
2290
return
2275
2291
;;
2276
2292
pull.twohead|pull.octopus)
2277
2293
__git_compute_merge_strategies
2278
- __gitcomp " $__git_merge_strategies "
2294
+ __gitcomp " $__git_merge_strategies " " " " $cur_ "
2279
2295
return
2280
2296
;;
2281
2297
color.pager)
2282
- __gitcomp " false true"
2298
+ __gitcomp " false true" " " " $cur_ "
2283
2299
return
2284
2300
;;
2285
2301
color.* .* )
2286
2302
__gitcomp "
2287
2303
normal black red green yellow blue magenta cyan white
2288
2304
bold dim ul blink reverse
2289
- "
2305
+ " " " " $cur_ "
2290
2306
return
2291
2307
;;
2292
2308
color.* )
2293
- __gitcomp " false true always never auto"
2309
+ __gitcomp " false true always never auto" " " " $cur_ "
2294
2310
return
2295
2311
;;
2296
2312
diff.submodule)
2297
- __gitcomp " $__git_diff_submodule_formats "
2313
+ __gitcomp " $__git_diff_submodule_formats " " " " $cur_ "
2298
2314
return
2299
2315
;;
2300
2316
help.format)
2301
- __gitcomp " man info web html"
2317
+ __gitcomp " man info web html" " " " $cur_ "
2302
2318
return
2303
2319
;;
2304
2320
log.date)
2305
- __gitcomp " $__git_log_date_formats "
2321
+ __gitcomp " $__git_log_date_formats " " " " $cur_ "
2306
2322
return
2307
2323
;;
2308
2324
sendemail.aliasfiletype)
2309
- __gitcomp " mutt mailrc pine elm gnus"
2325
+ __gitcomp " mutt mailrc pine elm gnus" " " " $cur_ "
2310
2326
return
2311
2327
;;
2312
2328
sendemail.confirm)
2313
- __gitcomp " $__git_send_email_confirm_options "
2329
+ __gitcomp " $__git_send_email_confirm_options " " " " $cur_ "
2314
2330
return
2315
2331
;;
2316
2332
sendemail.suppresscc)
2317
- __gitcomp " $__git_send_email_suppresscc_options "
2333
+ __gitcomp " $__git_send_email_suppresscc_options " " " " $cur_ "
2318
2334
return
2319
2335
;;
2320
2336
sendemail.transferencoding)
2321
- __gitcomp " 7bit 8bit quoted-printable base64"
2337
+ __gitcomp " 7bit 8bit quoted-printable base64" " " " $cur_ "
2322
2338
return
2323
2339
;;
2324
2340
* .* )
@@ -2430,7 +2446,8 @@ __git_complete_config_variable_name_and_value ()
2430
2446
{
2431
2447
case " $cur " in
2432
2448
* =* )
2433
- # in the next patch...
2449
+ __git_complete_config_variable_value \
2450
+ --varname=" ${cur%% =* } " --cur=" ${cur#* =} "
2434
2451
;;
2435
2452
* )
2436
2453
__git_complete_config_variable_name --sfx=' ='
0 commit comments