]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - copy-gitattributes-to-branches.sh
add a gitattributes helper script
[xonotic/xonotic.git] / copy-gitattributes-to-branches.sh
diff --git a/copy-gitattributes-to-branches.sh b/copy-gitattributes-to-branches.sh
new file mode 100755 (executable)
index 0000000..9d51eae
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+case "$0" in
+       /*)
+               me=$0
+               ;;
+       *)
+               me="$PWD/$0"
+               ;;
+esac
+export me
+
+case "$1" in
+       inner)
+               git config core.autocrlf input
+               git reset --hard
+               git for-each-ref 'refs/remotes/origin' | while read -r HASH TYPE REFNAME; do
+                       git checkout -t "${REFNAME#refs/remotes/}" || git checkout "${REFNAME#refs/remotes/origin/}"
+                       git reset --hard "$REFNAME"
+                       cp "${me%/*}/.gitattributes" .
+                       git update-index --refresh
+                       git commit -a -m"CRLF"
+               done
+               ;;
+       *)
+               ./all each "$me" inner
+               ;;
+esac