File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,16 @@ prompt_pure_async_git_fetch() {
292
292
# Set SSH `BachMode` to disable all interactive SSH password prompting.
293
293
export GIT_SSH_COMMAND=" ${GIT_SSH_COMMAND:- " ssh" } -o BatchMode=yes"
294
294
295
+ local ref
296
+ ref=$( command git symbolic-ref -q HEAD)
297
+ local -a remote
298
+ remote=($( command git for-each-ref --format=' %(upstream:remotename) %(refname)' $ref ) )
299
+
300
+ if [[ -z $remote [1] ]]; then
301
+ # No remote specified for this branch, skip fetch.
302
+ return 97
303
+ fi
304
+
295
305
# Default return code, which indicates Git fetch failure.
296
306
local fail_code=99
297
307
@@ -317,7 +327,13 @@ prompt_pure_async_git_fetch() {
317
327
fi
318
328
' CHLD
319
329
320
- command git -c gc.auto=0 fetch > /dev/null &
330
+ # Only fetch information for the current branch and avoid
331
+ # fetching tags or submodules to speed up the process.
332
+ command git -c gc.auto=0 fetch \
333
+ --quiet \
334
+ --no-tags \
335
+ --recurse-submodules=no \
336
+ $remote & > /dev/null &
321
337
wait $! || return $fail_code
322
338
323
339
unsetopt monitor
@@ -505,6 +521,13 @@ prompt_pure_async_callback() {
505
521
do_render=1
506
522
fi
507
523
;;
524
+ 97)
525
+ # No remote available, make sure to clear git arrows if set.
526
+ if [[ -n $prompt_pure_git_arrows ]]; then
527
+ typeset -g prompt_pure_git_arrows=
528
+ do_render=1
529
+ fi
530
+ ;;
508
531
99|98)
509
532
# Git fetch failed.
510
533
;;
You can’t perform that action at this time.
0 commit comments