]> git.xonotic.org Git - xonotic/xonotic.git/blob - copy-gitattributes-to-branches.sh
Merge branch 'master' of ssh://git.xonotic.org/xonotic
[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                         case "$REFNAME" in
19                                 refs/remotes/origin/HEAD)
20                                         continue
21                                         ;;
22                         esac
23                         git checkout -t "${REFNAME#refs/remotes/}" || git checkout "${REFNAME#refs/remotes/origin/}"
24                         git reset --hard "$REFNAME"
25                         echo "$attr" > ".gitattributes"
26                         find . -type f -exec touch {} \+
27                         git update-index --refresh
28                         git add .gitattributes
29                         git commit -a -m"CRLF fixes, .gitattributes file updated"
30                 done
31                 git checkout master
32                 true
33                 ;;
34         *)
35                 attr=`cat .gitattributes`
36                 export attr
37                 ./all each "$me" inner
38                 ./all checkout
39                 ;;
40 esac