mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Current problems:
- bash(1) is not always installed (by default), /bin/sh is
- (Open)BSD find(1) requires at least one path argument, i.e. `.` which GNU
find(1) implies
- (Open)BSD find(1) does not support `-ipath`
git-ls-files(1) benefits:
- gitignore(5) files are honored
- simpler/more powerful patterns (see gitglossary(7) wrt. `pathspec`)
- `runClangFormat.sh` can be run from git subdirectories to only format
selected files (explicitl passing files could be easil implemented)
- works on every system with git(1), no portability issues (see above)
The one "drawback" with git-ls-files(1) is requiring git(1) working tree
rather than a release tarball, but active development requries git
anyway, so that does not seem like a blocker.
Only run xargs(1) if files were listed (`-r`), since we can now run the
script from subdirectories without source code.
Avoid brace expansion (`'**/*'.{cpp,c,hpp,h,cxx,cc}`) to be compatible
with dash.
11 lines
436 B
Bash
Executable File
11 lines
436 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright 2020-2022 The Mumble Developers. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license
|
|
# that can be found in the LICENSE file at the root of the
|
|
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
|
|
|
|
git ls-files --cached --modified --others -z -- \
|
|
:^3rdparty/ '**/*'.cpp '**/*'.c '**/*'.hpp '**/*'.h '**/*'.cxx '**/*'.cc |
|
|
xargs -0 -r -- clang-format --style=file -i
|