xonotic/copy-gitattributes-to-branches.sh
2010-07-21 10:34:06 +02:00

39 lines
717 B
Bash
Executable File

#!/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
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"
echo "$attr" > "${me%/*}/.gitattributes"
git update-index --refresh
git commit -a -m"CRLF fixes, .gitattributes file updated"
done
git checkout master
true
;;
*)
attr=`cat .gitattributes`
export attr
./all each "$me" inner
./all checkout
;;
esac