File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 188188# clang-format-diff.
189189if [ " $whole_file " = false ]; then
190190 invalid=" /dev/null/invalid/path"
191+ if [ " ${OSTYPE:- } " = " linux-gnu" ]; then
192+ readonly sort_version=-V
193+ else
194+ # On macOS, sort doesn't have -V.
195+ readonly sort_version=-n
196+ fi
191197 declare paths_to_try=()
192198 # .deb packages directly from upstream.
193199 # We try these first as they are probably newer than the system ones.
194200 while read -r f; do
195201 paths_to_try+=(" $f " )
196- done < <( compgen -G " /usr/share/clang/clang-format-*/clang-format-diff.py" | sort -V -r)
202+ done < <( compgen -G " /usr/share/clang/clang-format-*/clang-format-diff.py" | sort " $sort_version " -r)
197203 # LLVM official releases (just untarred in /usr/local).
198204 while read -r f; do
199205 paths_to_try+=(" $f " )
200- done < <( compgen -G " /usr/local/clang+llvm*/share/clang/clang-format-diff.py" | sort -V -r)
206+ done < <( compgen -G " /usr/local/clang+llvm*/share/clang/clang-format-diff.py" | sort " $sort_version " -r)
201207 # Maybe it's in the $PATH already? This is true for Ubuntu and Debian.
202208 paths_to_try+=( \
203209 " $( which clang-format-diff 2> /dev/null || echo " $invalid " ) " \
You can’t perform that action at this time.
0 commit comments