Niedzielski has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/305758

Change subject: handle lots of files #chore
......................................................................

handle lots of files #chore

pass files on stdin instead of arguments. for simplicity, don't consider
capitalized filenames, of which there are none

Change-Id: I055c07c27276fcc4223a03cd581437442475b206
---
M dev-scripts/pre-commit
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/58/305758/1

diff --git a/dev-scripts/pre-commit b/dev-scripts/pre-commit
index 52392dc..90d6a28 100755
--- a/dev-scripts/pre-commit
+++ b/dev-scripts/pre-commit
@@ -12,6 +12,8 @@
        [[ diff -eq 1 ]] || return 1
 }
 
+map() { IFS= read -rd $'\0' "$@"; }
+
 # check for trailing whitespace
 git diff --cached --check
 
@@ -30,19 +32,17 @@
        make validatehtml > $result
 fi
 
-for file in `git-staged-files | grep -zi '\.png$'`
-do
+git-staged-files \*.png|while map file; do
        echo "Compressing $file"
        optipng -q -o7 "$file" && advpng -z -4 "$file" && advdef -z -4 "$file" 
| grep Output
        git add "$file"
 done
 
-for file in `git-staged-files | grep -zi '\.svg$'`
-do
+git-staged-files \*.svg|while map file; do
        make nodecheck
        echo "Compressing $file"
        # If anyone can figure out how to get the pretty option to work from 
the config
        # file, feel free to remove it here.
        node_modules/.bin/svgo --config=.svgo.yml "$file" --pretty
        git add "$file"
-done
+done
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/305758
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I055c07c27276fcc4223a03cd581437442475b206
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to