9d51eaee8e453f24325771d0ffe7af6f0386a34e
[xonotic/xonotic.git] / copy-gitattributes-to-branches.sh
1 #!/bin/sh
2
3 case "$0" in
4         /*)
5                 me=$0
6                 ;;
7         *)
8                 me="$PWD/$0"
9                 ;;
10 esac
11 export me
12
13 case "$1" in
14         inner)
15                 git config core.autocrlf input
16                 git reset --hard
17                 git for-each-ref 'refs/remotes/origin' | while read -r HASH TYPE REFNAME; do
18                         git checkout -t "${REFNAME#refs/remotes/}" || git checkout "${REFNAME#refs/remotes/origin/}"
19                         git reset --hard "$REFNAME"
20                         cp "${me%/*}/.gitattributes" .
21                         git update-index --refresh
22                         git commit -a -m"CRLF"
23                 done
24                 ;;
25         *)
26                 ./all each "$me" inner
27                 ;;
28 esac