Skip to content

Commit b0750fa

Browse files
committed
completion/git: shfmt && shellcheck
1 parent e22aac8 commit b0750fa

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

clean_files.txt

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ completion/available/docker-machine.completion.bash
4949
completion/available/docker.completion.bash
5050
completion/available/gcloud.completion.bash
5151
completion/available/gem.completion.bash
52+
completion/available/git.completion.bash
5253
completion/available/github-cli.completion.bash
5354
completion/available/go.completion.bash
5455
completion/available/helm.completion.bash

completion/available/git.completion.bash

+17-16
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,37 @@
66
_command_exists git || return
77

88
# Don't handle completion if it's already managed
9-
if complete -p git &>/dev/null; then
10-
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
11-
return 0
9+
if complete -p git &> /dev/null; then
10+
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
11+
return 0
1212
fi
1313

1414
_git_bash_completion_xcrun_git=
1515
if _command_exists xcrun; then
1616
_git_bash_completion_xcrun_git="$(xcrun --find git)"
1717
fi
1818
_git_bash_completion_paths=(
19-
# Standard locations
20-
"${GIT_EXE%/*}/../share/git-core/git-completion.bash"
21-
"${GIT_EXE%/*}/../share/git-core/contrib/completion/git-completion.bash"
22-
"${GIT_EXE%/*}/../etc/bash_completion.d/git-completion.bash"
23-
# MacOS non-system locations
24-
"${_git_bash_completion_xcrun_git%/bin/git}/share/git-core/git-completion.bash"
19+
# Standard locations
20+
"${GIT_EXE%/*}/../share/git-core/git-completion.bash"
21+
"${GIT_EXE%/*}/../share/git-core/contrib/completion/git-completion.bash"
22+
"${GIT_EXE%/*}/../etc/bash_completion.d/git-completion.bash"
23+
# MacOS non-system locations
24+
"${_git_bash_completion_xcrun_git%/bin/git}/share/git-core/git-completion.bash"
2525
)
2626

2727
# Load the first completion file found
2828
_git_bash_completion_found=false
29-
for _comp_path in "${_git_bash_completion_paths[@]}" ; do
30-
if [[ -r "$_comp_path" ]] ; then
31-
_git_bash_completion_found=true
32-
source "$_comp_path"
33-
break
34-
fi
29+
for _comp_path in "${_git_bash_completion_paths[@]}"; do
30+
if [[ -r "$_comp_path" ]]; then
31+
_git_bash_completion_found=true
32+
# shellcheck disable=SC1090 # don't follow
33+
source "$_comp_path"
34+
break
35+
fi
3536
done
3637

3738
# Cleanup
3839
if [[ "${_git_bash_completion_found}" == false ]]; then
39-
_log_warning "no completion files found - please try enabling the 'system' completion instead."
40+
_log_warning "no completion files found - please try enabling the 'system' completion instead."
4041
fi
4142
unset "${!_git_bash_completion@}"

0 commit comments

Comments
 (0)