aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-02-28 23:25:26 +0100
committerKarel Kočí <cynerd@email.cz>2017-02-28 23:25:26 +0100
commit3194d0e78e2cb50b484852a37491f9b9b2c81cc3 (patch)
tree2e81872b0be0ea0fed60a2fe6e5913e1e56ad3b1 /utils
parent5c9aa6a1bac34068e29e78afbc84331c83fe23a3 (diff)
parent356f7434da419d1a65a74423a99656653a28fb03 (diff)
downloadmyconfigs-3194d0e78e2cb50b484852a37491f9b9b2c81cc3.tar.gz
myconfigs-3194d0e78e2cb50b484852a37491f9b9b2c81cc3.tar.bz2
myconfigs-3194d0e78e2cb50b484852a37491f9b9b2c81cc3.zip
Merge branch 'master' of cynerd.cz:myconfigs
Diffstat (limited to 'utils')
-rw-r--r--utils/inst19
1 files changed, 14 insertions, 5 deletions
diff --git a/utils/inst b/utils/inst
index c3c26e2..cb1f658 100644
--- a/utils/inst
+++ b/utils/inst
@@ -51,12 +51,21 @@ checkdiff() {
fi
done
# Now checkout git repositories
- for g in `find "$1" -name .git -type f -printf '%h '`; do
+ for g in `find "$1" -type d -exec test -e '{}'/.git \; -print -prune`; do
G="${g#$1}"
- COMMIT=$( cd "$1/$G" && git rev-parse HEAD )
- echo "Checkout of git repository: $2/$G"
- # TODO this doesn't seems to work
- ( cd "$2/$G" && git --work-tree=. checkout -f "$COMMIT" )
+ PREV="$(pwd)"
+ cd "$2/$G"
+ # Check if we have any change at all
+ if git --work-tree=. diff --exit-code -s; then
+ echo "No difference detected in git: $2/$G"
+ else
+ echo "Checkout of git repository: $2/$G"
+ # Checkout all files to HEAD
+ git --work-tree=. checkout -f HEAD
+ # Update all submodules
+ git --work-tree=. submodule update
+ fi
+ cd "$PREV"
done
else
dodiff "$1" "$2"