Changes have been pushed for the repository "fawkesrobotics/fawkes".
Clone: https://github.com/fawkesrobotics/fawkes.git Gitweb: https://github.com/fawkesrobotics/fawkes The branch, thofmann/make-format-glob-expansion has been created at 8c9fd941f315085640cef0ec3302cba2b9c31ef4 (commit) https://github.com/fawkesrobotics/fawkes/tree/thofmann/make-format-glob-expansion - *Log* --------------------------------------------------------------- commit 8c9fd941f315085640cef0ec3302cba2b9c31ef4 Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Sun Jun 16 14:06:08 2019 +0200 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Sun Jun 16 14:24:32 2019 +0200 buildsys: expand globs in git ls-files with git, not the shell If we call `git ls-files *.{h,cpp}`, then (depending on the shell), the expansion of `*` may already be done by the shell instead of git. This is undesired, as the shell does not list files in sub-directories, in contrast to git. Thus, to make sure that we list all files, escape the glob `*` so we always pass it to git. This issue occurs when using zsh, but probably may also occur with bash, depending on the shell configuration. https://github.com/fawkesrobotics/fawkes/commit/8c9fd941f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *Summary* ----------------------------------------------------------- - *Diffs* ------------------------------------------------------------- - *commit* 8c9fd941f315085640cef0ec3302cba2b9c31ef4 - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Sun Jun 16 14:06:08 2019 +0200 Subject: buildsys: expand globs in git ls-files with git, not the shell etc/buildsys/format.mk | 8 ++++---- etc/buildsys/root/check.mk | 2 +- etc/buildsys/root/format.mk | 6 +++--- etc/format-scripts/check-all-files.sh | 2 +- etc/format-scripts/check-branch-files.sh | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) _Diff for modified files_: diff --git a/etc/buildsys/format.mk b/etc/buildsys/format.mk index 18d799831..924efe16f 100644 --- a/etc/buildsys/format.mk +++ b/etc/buildsys/format.mk @@ -23,8 +23,8 @@ format-modified-clang: $(SILENT) echo -e "$(INDENT_PRINT)[FMT] Formatting modified files (git)" $(SILENTSYMB)if type -p clang-format >/dev/null; then \ pushd $(SRCDIR) >/dev/null; \ - MODIFIED_FILES=$$(git ls-files -m *.{h,cpp}); \ - UNTRACKED_FILES=$$(git ls-files --exclude-standard --others *.{h,cpp}); \ + MODIFIED_FILES=$$(git ls-files -m \*.{h,cpp}); \ + UNTRACKED_FILES=$$(git ls-files --exclude-standard --others \*.{h,cpp}); \ FILES=$$(echo "$$MODIFIED_FILES" "$$UNTRACKED_FILES" | tr ' ' '\n' | sort -u); \ if [ -n "$$FILES" ]; then \ if type -p parallel >/dev/null; then \ @@ -44,7 +44,7 @@ format-all: $(SILENT) echo -e "$(INDENT_PRINT)[FMT] Formatting all local files (git)" $(SILENTSYMB)if type -p clang-format >/dev/null; then \ pushd $(SRCDIR) >/dev/null; \ - FILES=$$(git ls-files *.{h,cpp}); \ + FILES=$$(git ls-files \*.{h,cpp}); \ if [ -n "$$FILES" ]; then \ if type -p parallel >/dev/null; then \ parallel -u --will-cite --bar clang-format -i ::: $$FILES; \ @@ -62,7 +62,7 @@ format-all: format-diff: $(SILENTSYMB)if type -p clang-format >/dev/null; then \ pushd $(SRCDIR) >/dev/null; \ - FILES=$$(git ls-files *.{h,cpp}); \ + FILES=$$(git ls-files \*.{h,cpp}); \ if [ -n "$$FILES" ]; then \ for f in $$FILES; do \ DIFF=$$(diff -u $$f <(clang-format $$f)); \ diff --git a/etc/buildsys/root/check.mk b/etc/buildsys/root/check.mk index 940c6dadb..0fd529a5e 100644 --- a/etc/buildsys/root/check.mk +++ b/etc/buildsys/root/check.mk @@ -53,7 +53,7 @@ format-check: check-parallel for f in $$OFFENDING_FILES; do \ echo -e "$(INDENT_PRINT)$(TRED)--> $$f is not properly formatted$(TNORMAL)"; \ done; \ - NUM_FILES=$$(git ls-files *.{h,cpp} | wc -l); \ + NUM_FILES=$$(git ls-files \*.{h,cpp} | wc -l); \ BAD_FILES=$$(wc -w <<< "$$OFFENDING_FILES"); \ echo -e "$(INDENT_PRINT)$(TRED)--> $$BAD_FILES/$$NUM_FILES have bad formatting.$(TNORMAL)"; \ exit 1; \ diff --git a/etc/buildsys/root/format.mk b/etc/buildsys/root/format.mk index e19a606f1..85f5b1367 100644 --- a/etc/buildsys/root/format.mk +++ b/etc/buildsys/root/format.mk @@ -24,7 +24,7 @@ __buildsys_root_format_mk_ := 1 format-clang: check-parallel $(SILENT) echo -e "$(INDENT_PRINT)[FMT] Formatting full tree" $(SILENTSYMB)if type -p clang-format >/dev/null; then \ - ALL_FILES=$$(git ls-files *.{h,cpp}); \ + ALL_FILES=$$(git ls-files \*.{h,cpp}); \ if type -p parallel >/dev/null; then \ parallel -u --will-cite --bar clang-format -i ::: $$ALL_FILES; \ else \ @@ -39,7 +39,7 @@ format-clang: check-parallel format-modified-clang: check-parallel $(SILENT) echo -e "$(INDENT_PRINT)[FMT] Formatting modified files (git)" $(SILENTSYMB)if type -p clang-format >/dev/null; then \ - ALL_FILES=$$(git ls-files -m *.{h,cpp}); \ + ALL_FILES=$$(git ls-files -m \*.{h,cpp}); \ if type -p parallel >/dev/null; then \ parallel -u --will-cite --bar clang-format -i ::: $$ALL_FILES; \ else \ @@ -72,7 +72,7 @@ format-emacs: check-parallel $(SILENT) echo -e "$(INDENT_PRINT)[FMT] Formatting (emacs) where necessary" $(SILENT) echo -e "$(INDENT_PRINT)[FMT] $(TYELLOW)Use 'format' target to use clang-format$(TNORMAL)" $(SILENTSYMB)if type -p emacs >/dev/null; then \ - ALL_FILES=$$(git ls-files *.{h,cpp}); \ + ALL_FILES=$$(git ls-files \*.{h,cpp}); \ if type -p parallel >/dev/null; then \ export FAWKES_BASEDIR=$(abspath $(FAWKES_BASEDIR)); \ parallel -u --will-cite --bar --results /tmp/emacs-format -- emacs -q --batch {} -l $(abspath $(FAWKES_BASEDIR))/etc/format-scripts/emacs-format-cpp.el -f format-code ::: $$ALL_FILES; \ diff --git a/etc/format-scripts/check-all-files.sh b/etc/format-scripts/check-all-files.sh index ae6fb93ee..108d42d17 100755 --- a/etc/format-scripts/check-all-files.sh +++ b/etc/format-scripts/check-all-files.sh @@ -16,7 +16,7 @@ SCRIPT_PATH=$(dirname $(readlink -f ${BASH_SOURCE[0]})) -ALL_FILES=$(git ls-files *.{h,cpp}) +ALL_FILES=$(git ls-files \*.{h,cpp}) if type -p parallel >/dev/null; then OFFENDING_FILES=$(parallel --will-cite --bar $SCRIPT_PATH/check-file.sh ::: $ALL_FILES) else diff --git a/etc/format-scripts/check-branch-files.sh b/etc/format-scripts/check-branch-files.sh index d6f08a429..c17b5ffca 100755 --- a/etc/format-scripts/check-branch-files.sh +++ b/etc/format-scripts/check-branch-files.sh @@ -33,7 +33,7 @@ MERGE_BASE=$($DIFF --old-line-format='' --new-line-format='' \ | head -1) AFFECTED_FILES=$(git diff --name-only $MERGE_BASE HEAD | grep -E '\.(cpp|h)$' | paste -sd " " -) -MODIFIED_FILES=$(git ls-files -m *.{h,cpp}) +MODIFIED_FILES=$(git ls-files -m \*.{h,cpp}) # If no (C++) files are affected we are done if [ -z "$AFFECTED_FILES" -a -z "$MODIFIED_FILES" ]; then _______________________________________________ fawkes-commits mailing list fawkes-commits@lists.kbsg.rwth-aachen.de https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits