1 changed files with 22 additions and 6 deletions
@ -1,25 +1,41 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
|
|
||||||
#Создан: Вс 25 авг 2013 19:40:12 |
#Создан: Вс 25 авг 2013 19:40:12 |
||||||
#Изменён: Ср 28 авг 2013 20:24:59 |
#Изменён: Сб 22 мар 2014 12:02:37 |
||||||
|
|
||||||
# Добавление файлов с меткой +GITIGNORE в исключения .git |
# Добавление файлов с меткой +GITIGNORE в исключения .git |
||||||
|
|
||||||
|
# Создание копии файлов с меткой +GITIGNORE +SAMPLE |
||||||
|
make_sample() { |
||||||
|
\grep -E '^.{1,5}\+GITIGNORE \+SAMPLE' "$1" 2>&- > /dev/null && \ |
||||||
|
if [ ! -f "${1/.sample/}.sample" ]; then |
||||||
|
cp -iv $1 $1.sample |
||||||
|
sed -i 's/\+GITIGNORE.\+SAMPLE/+SAMPLE/' $1.sample |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
# Метка должна располагаться не далее пятой колонки |
# Метка должна располагаться не далее пятой колонки |
||||||
\grep -E '^.{1,5}\+GITIGNORE' -R > /tmp/gitignore.tmp |
\grep -E '^.{1,5}\+GITIGNORE' -R --exclude-dir=var 2>&- > /tmp/gitignore.$$ |
||||||
|
|
||||||
if [ -f ".gitignore" ]; then |
if [ -f ".gitignore" ]; then |
||||||
while read line; do |
while read line; do |
||||||
echo lll $line |
echo "COPY:" "$line" |
||||||
sed -i "/${line//\//.}/d" /tmp/gitignore.tmp 2> /dev/null |
make_sample "$line" |
||||||
|
sed -i "/${line//\//.}/d" /tmp/gitignore.$$ 2> /dev/null |
||||||
done < .gitignore |
done < .gitignore |
||||||
fi |
fi |
||||||
|
|
||||||
|
if [ -f "/tmp/gitignore.$$" ]; then |
||||||
|
while read line; do |
||||||
|
make_sample "${line/:*/}" |
||||||
|
done < /tmp/gitignore.$$ |
||||||
|
fi |
||||||
|
|
||||||
echo "\n# [ $(\date +%d.%m.%Y) ]\n" >> .gitignore |
echo "\n# [ $(\date +%d.%m.%Y) ]\n" >> .gitignore |
||||||
|
|
||||||
cut -d ':' -f 1 /tmp/gitignore.tmp | sort -u >> .gitignore |
cut -d ':' -f 1 /tmp/gitignore.$$ | sort -u >> .gitignore |
||||||
|
|
||||||
echo >> .gitignore |
echo >> .gitignore |
||||||
|
|
||||||
\rm /tmp/gitignore.tmp |
\rm /tmp/gitignore.$$ |
||||||
|
|
||||||
|
Loading…
Reference in new issue