Commit 0424f1aa authored by Mike Frysinger's avatar Mike Frysinger Committed by Commit Bot

optimize-png-files.sh: relax cwd restriction

There's nothing in this script that really requires being run in the
top level of the src.git repo other than the git commit logic.  That
means we can run this script completely outside of src.git if given
a set of paths to operate on.  Move the check into the git scenario.

Bug: None
Test: ran the script outside of src.git on some png files
Change-Id: I4d1343f3757a05e8675ac80c618c8b4ec23e1695
Reviewed-on: https://chromium-review.googlesource.com/1097615Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566690}
parent bc67c049
......@@ -419,11 +419,6 @@ Options:
exit 1
}
if [ ! -e ../.gclient ]; then
echo "$0 must be run in src directory"
exit 1
fi
if [ "$(expr substr $(uname -s) 1 6)" == "CYGWIN" ]; then
using_cygwin=true
else
......@@ -512,6 +507,12 @@ set ${DIRS:=$ALL_DIRS}
info "Optimize level=$OPTIMIZE_LEVEL"
if [ -n "$COMMIT" ] ; then
# To keep git logic below sane, require it be run from the top dir.
if [ ! -e ../.gclient ]; then
echo "$0 must be run in src directory"
exit 1
fi
ALL_FILES=$(git diff --name-only $COMMIT HEAD $DIRS | grep "png$")
ALL_FILES_LIST=( $ALL_FILES )
echo "Processing ${#ALL_FILES_LIST[*]} files"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment