diff options
author | Slávek Banko <[email protected]> | 2013-05-05 02:30:01 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-05-05 02:30:01 +0200 |
commit | 7e23a1ee30a44babc95d17e3ecbb233e14f650c2 (patch) | |
tree | 910c6b792522f70395b74a051005fd076f960ae0 /switch_all_submodules_to_head_and_clean | |
parent | f7f29b7ce2aa3f1b5b93800bfabddb51104d57d1 (diff) | |
download | scripts-7e23a1ee30a44babc95d17e3ecbb233e14f650c2.tar.gz scripts-7e23a1ee30a44babc95d17e3ecbb233e14f650c2.zip |
Added ignore-submodules flag, depending on the GIT version
Diffstat (limited to 'switch_all_submodules_to_head_and_clean')
-rwxr-xr-x | switch_all_submodules_to_head_and_clean | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/switch_all_submodules_to_head_and_clean b/switch_all_submodules_to_head_and_clean index 6313812..986dc0c 100755 --- a/switch_all_submodules_to_head_and_clean +++ b/switch_all_submodules_to_head_and_clean @@ -13,6 +13,11 @@ if [[ -z "$branch" ]] || exit 1 fi +# check git abilities +if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then + GIT_IGNORE_SUBMODULES="--ignore-submodules" +fi + echo "Preparing $PWD for development use" if [[ $1 == "" ]]; then gituser=`sed -n "/^\[remote \"origin\"\]/,/url/s/\turl = http:\/\/\([^@]*\)@.*/\1/p" <\`git rev-parse --git-dir\`/config | grep -v "\(anonymous\|system\)"` @@ -35,12 +40,12 @@ if [[ ! -e "$THISSCRIPT" ]]; then exit 1 fi -if [[ ! -z "`git status --porcelain`" ]]; then +if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then git reset --hard HEAD git clean -dxff fi git pull -if [[ ! -z "`git status --porcelain`" ]]; then +if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then git reset --hard HEAD git clean -dxff fi |