diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-05-05 02:30:01 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-05-05 02:31:24 +0200 |
commit | 47fb38fad730f4fdfc21e6a89dea1c7a63bb0b71 (patch) | |
tree | 481acb1d76a7fafc52cc653b55ffb9ab2c1cd34f | |
parent | d8d6594611b0ca874170858f0649795fdb582ff3 (diff) | |
download | scripts-47fb38fad730f4fdfc21e6a89dea1c7a63bb0b71.tar.gz scripts-47fb38fad730f4fdfc21e6a89dea1c7a63bb0b71.zip |
Added ignore-submodules flag, depending on the GIT versionv3.5.13.2
(cherry picked from commit 7e23a1ee30a44babc95d17e3ecbb233e14f650c2)
-rwxr-xr-x | switch_all_submodules_to_head_and_clean | 9 | ||||
-rwxr-xr-x | update_all_submodules | 9 |
2 files changed, 14 insertions, 4 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 diff --git a/update_all_submodules b/update_all_submodules index 498dcef..563b3bd 100755 --- a/update_all_submodules +++ b/update_all_submodules @@ -19,12 +19,17 @@ 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 + touch /var/lock/update-tde-git-submodules PARENTDIR=$PWD echo "Working in $PARENTDIR" 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 @@ -44,7 +49,7 @@ do git submodule update fi cd $PARENTDIR/$DIR2UPDATE - if [[ ! -z "`git status --porcelain`" ]]; then + if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then git reset --hard HEAD git clean -dxff fi |