[epiphany] uncrustify improvements
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] uncrustify improvements
- Date: Mon, 15 Jul 2019 18:48:51 +0000 (UTC)
commit 60d88e8045ba2dabcb33b659a9929a703a14fed3
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Mon Jul 15 20:34:59 2019 +0200
uncrustify improvements
1. use a proper name for the patch file: "epiphany-ccs-$date.patch"
2. clean up old patches if necessary
3. remove one copy step
4. update patch format so that it applies cleanly
data/check-code-style | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/data/check-code-style b/data/check-code-style
index 57b604e39..86885e224 100755
--- a/data/check-code-style
+++ b/data/check-code-style
@@ -16,20 +16,28 @@ then
exit 1
fi
-patch=$(mktemp)
+# create a filename to store our generated patch
+prefix="epiphany-ccs"
+suffix="$(date +%C%y-%m-%d_%Hh%Mm%Ss)"
+patch="/tmp/$prefix-$suffix.patch"
-for DIR in $SOURCE_ROOT/embed $SOURCE_ROOT/lib $SOURCE_ROOT/src $SOURCE_ROOT/tests
+# clean up old patches
+rm -f /tmp/$prefix*.patch
+
+pushd $SOURCE_ROOT
+for DIR in embed lib src tests
do
# Aligning prototypes is not working yet, so avoid headers
for FILE in $(find "$DIR" -name "*.c" ! -path "*/contrib/*")
do
- cp $FILE $FILE.check
- "$UNCRUSTIFY" -c "$SOURCE_ROOT/data/uncrustify.cfg" --replace --no-backup "$FILE.check"
- "$LINEUP_PARAMETERS" "$FILE.check" > "$FILE.temp" && mv "$FILE.temp" "$FILE.check"
- diff -u "$FILE" "$FILE.check" | sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch"
- rm $FILE.check
+ "$UNCRUSTIFY" -c "data/uncrustify.cfg" --no-backup "$FILE"
+ "$LINEUP_PARAMETERS" "$FILE.uncrustify" > "$FILE.temp" && mv "$FILE.temp" "$FILE.uncrustify"
+ diff -urN "$FILE" "$FILE.uncrustify" | \
+ sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch"
+ rm "$FILE.uncrustify"
done
done
+popd
if [ ! -s "$patch" ] ; then
printf "** Commit is valid. \\o/\n"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]