mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 11:30:55 +00:00
tools: enable stylechecker to handle new files
Since the tool is entirely diff based, it was having some issues diffing things that didn't exist. Also made it a bit smarter about ignoring kernel-specific style nits we don't really care about. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
a162e6a599
commit
f5fd113cbf
@ -13,15 +13,18 @@ if [[ -z "$1" || -z "$2" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# remove temp directories
|
||||
rm -rf /tmp/f1 /tmp/f2
|
||||
|
||||
# save working tree
|
||||
if git -C $tree status --porcelain | egrep --silent '^(\?\?|.[DM])'; then
|
||||
echo "Detected dirty tree, caching state..."
|
||||
dirty=1
|
||||
git -C $tree config gc.auto 0;
|
||||
td=$(git -C $tree status -z | grep -z "^[ARM]D" | cut -z -d' ' -f2- | tr '\0' '\n')
|
||||
INDEX=`git -C $tree write-tree`
|
||||
INDEX=$(git -C $tree write-tree)
|
||||
git -C $tree add -f .
|
||||
WORKTREE=`git -C $tree write-tree`
|
||||
WORKTREE=$(git -C $tree write-tree)
|
||||
echo "Saved index to $INDEX"
|
||||
echo "Saved working tree to $WORKTREE"
|
||||
fi
|
||||
@ -36,11 +39,14 @@ git -C $tree reset --hard
|
||||
git -C $tree apply < $patch
|
||||
mkdir -p /tmp/f1 /tmp/f2
|
||||
mod=$(git -C $tree ls-files -m | grep ".*\.[ch]" | grep -v $ignore)
|
||||
mod+=" $(git -C $tree ls-files --others --exclude-standard | grep '.*\.[ch]' | grep -v $ignore)"
|
||||
echo $mod
|
||||
if [ -z "$mod" ]; then
|
||||
echo "There doesn't seem to be any changes."
|
||||
else
|
||||
cp $tree/$mod /tmp/f1/
|
||||
git -C $tree reset --hard
|
||||
git -C $tree clean -fd
|
||||
cp $tree/$mod /tmp/f2/
|
||||
echo "Running style checks..."
|
||||
for file in /tmp/f1/*; do
|
||||
@ -56,12 +62,11 @@ else
|
||||
echo "Report for $(basename $file _cp)"
|
||||
echo "==============================================="
|
||||
if [ -a /tmp/f2/$(basename $file) ]; then
|
||||
diff $file /tmp/f2/$(basename $file) | grep -A3 "ERROR\|WARNING"
|
||||
diff $file /tmp/f2/$(basename $file) | grep -v "normally be const" | grep -A3 "ERROR\|WARNING"
|
||||
else
|
||||
cat $file
|
||||
cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING"
|
||||
fi
|
||||
done
|
||||
rm -rf /tmp/f1 /tmp/f2
|
||||
fi
|
||||
|
||||
# restore working tree
|
||||
|
Loading…
Reference in New Issue
Block a user