fix usage of HEAD
[xonotic/xonotic.git] / copy-gitattributes-to-branches.sh
index 9d51eaee8e453f24325771d0ffe7af6f0386a34e..90b98ed413c8b5e7729b87286822a27f3bad0db3 100755 (executable)
@@ -15,14 +15,22 @@ case "$1" in
                git config core.autocrlf input
                git reset --hard
                git for-each-ref 'refs/remotes/origin' | while read -r HASH TYPE REFNAME; do
+                       case "$REFNAME" in
+                               refs/remotes/origin/HEAD)
+                                       continue
+                                       ;;
+                       esac
                        git checkout -t "${REFNAME#refs/remotes/}" || git checkout "${REFNAME#refs/remotes/origin/}"
                        git reset --hard "$REFNAME"
-                       cp "${me%/*}/.gitattributes" .
+                       echo "$attr" > "${me%/*}/.gitattributes"
                        git update-index --refresh
-                       git commit -a -m"CRLF"
+                       git commit -a -m"CRLF fixes, .gitattributes file updated"
                done
                ;;
        *)
+               attr=`cat .gitattributes`
+               export attr
                ./all each "$me" inner
+               ./all checkout
                ;;
 esac