-
-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathdo_remove_trailing_whitespace.sh
More file actions
executable file
·25 lines (23 loc) · 1.14 KB
/
do_remove_trailing_whitespace.sh
File metadata and controls
executable file
·25 lines (23 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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. Patterns
# with this "# check trailing whitespace" on the line before are checked
# (lines in .gitattributes starting with '#' are ignored).
##
awk '/# remove trailing whitespace/{do getline; while ($0 ~ /^#/); print $1}' .gitattributes |
while read i ; do
echo "Removing trailing whitespace on $i files"
git ls-files -z -- "$i" ":!./plugins/org.eclipse.embedcdt.core/src/org/eclipse/embedcdt/core/liqp" ":!./plugins/org.eclipse.embedcdt.core/src/org/eclipse/embedcdt/core/zafarkhaja/semver" | xargs --null --no-run-if-empty sed -i 's/[ \t]*$//'
done