1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
cdt/releng/scripts/do_remove_trailing_whitespace.sh
Jonah Graham 0631233154 [releng] Add missing copyright headers to releng scripts
Change-Id: I68cdf1f8adc1e59f47bb610c8aaeb583ca6cf39b
2020-08-30 20:25:40 -04:00

24 lines
916 B
Bash
Executable file

#!/bin/bash
###############################################################################
# Copyright (c) 2018, 2020 Kichwa Coders Ltd and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
###############################################################################
set -e
##
# Remove trailing whitespace.
# The .gitattributes is used as a filter to identify files to check. Patters with
# this "# check trailing whitespace" on the line before are checked
##
awk '/# remove trailing whitespace/{getline; print $1}' .gitattributes |
while read i ; do
echo "Removing trailing whitespace on $i files"
git ls-files -- "$i" | xargs --no-run-if-empty sed -i 's/[ \t]*$//'
done