aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/set-svn-properties.sh
blob: cfd3c93f58ffd283478d14a7910a69edb1683a27 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

set_eol_style()
{
    IFS=$'\n'
    for file in `find . -iname \*\.$1`; do
        prop=`svn propget svn:eol-style $file`
        if [ -z "${prop}" -o "${prop}" != "native" ]; then
            svn propset svn:eol-style native $file
        fi
    done
    IFS=$' \t\n'
}

remove_executable()
{
    IFS=$'\n'
    for file in `find . -iname \*\.$1`; do
        prop=`svn propget svn:executable $file`
        if [ -n "${prop}" ]; then
            svn propdel svn:executable $file
        fi
    done
    IFS=$' \t\n'
}

set_executable()
{
    IFS=$'\n'
    for file in `find . -iname \*\.$1`; do
        prop=`svn propget svn:executable $file`
        if [ -z "${prop}" ]; then
            svn propset svn:executable "*" $file
        fi
    done
    IFS=$' \t\n'
}

EOL_EXTENSIONS="cs ini example txt sql xml sh"
NO_EXE_EXTENSIONS="cs ini example txt sql xml"
EXE_EXTENSIONS="exe sh"

for ext in ${EOL_EXTENSIONS}; do
    set_eol_style $ext
done

for ext in ${NO_EXE_EXTENSIONS}; do
    remove_executable $ext
done

for ext in ${EXE_EXTENSIONS}; do
    set_executable $ext
done