From 30d89a121d1b3c6bba5e603641167e8097d3aa45 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 6 Jul 2022 10:43:54 +0200 Subject: [PATCH] contrib: fix "nm-python-black-format.sh" script to ignore systemd,c-util,nettools files Otherwise, the path "src/c-stdaux/src/docs/conf.py" matches for formatting. But this file is imported via git-subtree, we don't want to format it. Filter out such paths. --- contrib/scripts/nm-python-black-format.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/scripts/nm-python-black-format.sh b/contrib/scripts/nm-python-black-format.sh index 869c47f7f8..eae84fdb8e 100755 --- a/contrib/scripts/nm-python-black-format.sh +++ b/contrib/scripts/nm-python-black-format.sh @@ -75,6 +75,16 @@ FILES=() FILES+=( $(git ls-tree --name-only -r HEAD | grep '\.py$') ) FILES+=( $(git grep -l '#!.*\') ) FILES=( $(printf "%s\n" "${FILES[@]}" | sort -u) ) + +# Filter out paths that are forked from upstream projects and not +# ours to reformat. +FILES=( $( + printf "%s\n" "${FILES[@]}" | + sed \ + -e '/^src\/[cn]-[^/]\+\//d' \ + -e '/^src\/libnm-systemd-[^/]\+\/src\//d' +) ) + IFS="$OLD_IFS" if [ $SHOW_FILENAMES = 1 ]; then