Last active
March 31, 2025 13:34
-
-
Save mgoellnitz/87daa96ca023245a93fcc2c44faac570 to your computer and use it in GitHub Desktop.
Find any non-CoreMedia-originating changes in your workspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Find any changes in your workspace, which do not stem from the original | |
# CoreMedia internal sources. Optionally compare with CoreMedia or other | |
# git reference if there are any false positives from merges. | |
# | |
# Must be called from within workspace. | |
# | |
# Copyright 2018-2025 Martin Goellnitz | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
# | |
usage() { | |
echo "Usage: $0 [-r reference]" 1>&2 | |
echo "" 1>&2 | |
echo " -r reference optional additional check against given git reference (e.g. branch)" 1>&2 | |
exit 1 | |
} | |
while getopts "r:" opt ; do | |
case "${opt}" in | |
r) | |
REFERENCE=$OPTARG | |
;; | |
*) | |
usage | |
;; | |
esac | |
done | |
shift $((OPTIND-1)) | |
if [ ! -f workspace-configuration/extensions/README.md ] ; then | |
if [ ! -f ./blueprint-parent/pom.xml ] ; then | |
echo "$0 must be called from within CMCC-11 / CMCC-10 / CMS-9 workspace" | |
echo "" | |
usage | |
exit 1 | |
fi | |
fi | |
CURRENT=$(git branch |grep -e '^*'|cut -d ' ' -f 2) | |
submodules=$(git submodule status|cut -d ' ' -f 3) | |
for f in $(find . -type f|sed -e 's/\ /xxx/g'|grep -v target|grep -v frontend.node_modules|grep -v .remote-packages|grep -v ^...git) ; do | |
i=$(echo $f|sed -e 's/xxx/ /g') | |
# echo "xx $i" | |
for s in $submodules ; do | |
# echo " s: $s" | |
match=$(echo $i | grep "$s" | wc -l) | |
if [ $match -gt 0 ] ; then | |
i="" | |
fi | |
done | |
if [ ! -z "$i" ] ; then | |
LINECOUNT=$(git log --format="%h %an" "$i"|grep -v coremedia-ci|grep -v Simmendinger|grep -v Bauer|grep -v Wienberg|grep -v Holtkamp|wc -l) | |
# TEST=$(git log --format="%h %an %s" "$i"|grep -v coremedia-ci|grep -v Simmendinger|grep -v Bauer|grep -v Wienberg|grep -v Holtkamp) | |
# echo "$i: $LINECOUNT ($TEST)" | |
if [ $LINECOUNT -gt 0 ] ; then | |
if [ ! -z "$REFERENCE" ] ; then | |
# echo $CURRENT $REFERENCE "$i" | |
DIFFCOUNT=$(git diff $CURRENT $REFERENCE "$i"|wc -l) | |
if [ $DIFFCOUNT -gt 0 ] ; then | |
LABEL="" | |
DIFFHEAD=$(git diff $CURRENT $REFERENCE "$i"|head -7) | |
if [ ! -z "$(echo $DIFFHEAD|grep +++..dev.null)" ] ; then | |
LABEL="(custom)" | |
else | |
if [ ! -z "$(echo $DIFFHEAD|grep dev.null.differ)" ] ; then | |
LABEL="(custom)" | |
else | |
if [ ! -z "$(echo $DIFFHEAD|grep deleted.file.mode)" ] ; then | |
LABEL="(custom)" | |
fi | |
fi | |
fi | |
echo ${i}$LABEL | |
fi | |
else | |
echo $i | |
fi | |
# echo $i: $TEST | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment