1
1
openmpi/contrib/whitespace-purge.sh
Nathan Hjelm b4fcd3897e Simplify whitespace purge script a little.
Do not need to test with -f. If directories ever show up in git
ls-files (unlikely) their mime type is application/x-directory which
will fail the test ${file::4} == text check.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2015-08-24 09:30:46 -06:00

24 строки
740 B
Bash
Исполняемый файл

#!/bin/bash
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
# reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
for file in $(git ls-files) ; do
# check for the mime-type and do not follow symbolic links. this
# will cause file to print application/x-symlink for the mime-type
# allowing us to only have to check if the type is application to
# skip sym links, pdfs, etc. If any other file types should be
# skipped add the check here.
type=$(file -b --mime-type -h $file)
if test ${type::4} == "text" ; then
LC_ALL=C sed -i '' -E "s/[[:space:]]*$//" $file
fi
done