mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Add script to manage gitignore anchors
Added scripts which comment and uncomment out patterns relating to generated files. Signed-off-by: Agathiyan Bragadeesh <agabra02@e127300.arm.com>
This commit is contained in:
23
scripts/gitignore_add_generated_files.sh
Normal file
23
scripts/gitignore_add_generated_files.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
GITIGNORES=$(find . -name ".gitignore")
|
||||
|
||||
for GITIGNORE in $GITIGNORES; do
|
||||
IN_GEN_BLOCK=false
|
||||
while read -r line; do
|
||||
if [ "$line" = "###START_COMMENTED_GENERATED_FILES###" ]; then
|
||||
IN_GEN_BLOCK=true
|
||||
echo "###START_GENERATED_FILES###"
|
||||
elif [ "$line" = "###END_COMMENTED_GENERATED_FILES###" ]; then
|
||||
IN_GEN_BLOCK=false
|
||||
echo "###END_GENERATED_FILES###"
|
||||
elif $IN_GEN_BLOCK ; then
|
||||
echo "${line:1}"
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done <$GITIGNORE > "$GITIGNORE.tmp"
|
||||
mv "$GITIGNORE.tmp" $GITIGNORE
|
||||
done
|
23
scripts/gitignore_remove_generated_files.sh
Normal file
23
scripts/gitignore_remove_generated_files.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
GITIGNORES=$(find . -name ".gitignore")
|
||||
|
||||
for GITIGNORE in $GITIGNORES; do
|
||||
IN_GEN_BLOCK=false
|
||||
while read -r line; do
|
||||
if [ "$line" = "###START_GENERATED_FILES###" ]; then
|
||||
IN_GEN_BLOCK=true
|
||||
echo "###START_COMMENTED_GENERATED_FILES###"
|
||||
elif [ "$line" = "###END_GENERATED_FILES###" ]; then
|
||||
IN_GEN_BLOCK=false
|
||||
echo "###END_COMMENTED_GENERATED_FILES###"
|
||||
elif $IN_GEN_BLOCK ; then
|
||||
echo "#$line"
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done <$GITIGNORE > "$GITIGNORE.tmp"
|
||||
mv "$GITIGNORE.tmp" $GITIGNORE
|
||||
done
|
Reference in New Issue
Block a user