mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00

Add enforecment script that verifies that only specified file types are allowed to be mared as executable. Change-Id: I4b40e3a46b03bfc78a9dcd52e8bf29cb079b7f3b Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
31 lines
1.2 KiB
Bash
Executable file
31 lines
1.2 KiB
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 execute permission from all files in the repository.
|
|
##
|
|
echo "Removing execute permission from all files in repository"
|
|
git ls-files -z | xargs --null --no-run-if-empty chmod -x
|
|
|
|
##
|
|
# Enforce certain file types to have execute permission.
|
|
# The .gitattributes is used as a filter to identify files to add execute
|
|
# permissions to. Patterns with this "# file permission +x" on the line before
|
|
# are considered (lines in .gitattributes starting with '#' are ignored).
|
|
##
|
|
awk '/# file permission \+x/{do getline; while ($0 ~ /^#/); print $1}' .gitattributes |
|
|
while read i ; do
|
|
echo "Adding execute permission to $i files"
|
|
git ls-files -z -- "$i" | xargs --null --no-run-if-empty chmod +x
|
|
done
|