xonotic/copy-gitattributes-to-branches.sh

40 lines
734 B
Bash
Raw Normal View History

2010-07-21 08:24:45 +00:00
#!/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
2010-07-21 08:29:40 +00:00
case "$REFNAME" in
refs/remotes/origin/HEAD)
continue
;;
esac
2010-07-21 08:24:45 +00:00
git checkout -t "${REFNAME#refs/remotes/}" || git checkout "${REFNAME#refs/remotes/origin/}"
git reset --hard "$REFNAME"
2010-07-21 08:52:05 +00:00
echo "$attr" > ".gitattributes"
2010-07-21 08:24:45 +00:00
git update-index --refresh
2010-07-21 08:47:39 +00:00
git add .gitattributes
2010-07-21 08:29:40 +00:00
git commit -a -m"CRLF fixes, .gitattributes file updated"
2010-07-21 08:24:45 +00:00
done
2010-07-21 08:34:06 +00:00
git checkout master
2010-07-21 08:32:45 +00:00
true
2010-07-21 08:24:45 +00:00
;;
*)
2010-07-21 08:26:47 +00:00
attr=`cat .gitattributes`
export attr
2010-07-21 08:24:45 +00:00
./all each "$me" inner
2010-07-21 08:26:47 +00:00
./all checkout
2010-07-21 08:24:45 +00:00
;;
esac