aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinstall8
-rw-r--r--utils/inst19
2 files changed, 18 insertions, 9 deletions
diff --git a/install b/install
index 0768586..ceee9be 100755
--- a/install
+++ b/install
@@ -42,15 +42,15 @@ fi
read -p "Install VIM scripts? (Y/n) "
YCM_PATH=~/.vim/bundle/YouCompleteMe
if [[ $REPLY =~ ^[Yy]?$ ]]; then
- YCM_REV="$(cd $YCM_PATH && git --work-tree=. rev-parse HEAD)"
+ # See if we have anything different from what we have in repository
+ YCM_REV="$(cd $YCM_PATH && git --work-tree=. diff --exit-code -s && echo y)"
inst vimrc ~/.vimrc
inst vim/ ~/.vim
inst local/bin/vim-project-gen ~/.local/bin/vim-project-gen
mkdir -p ~/.cache/vim # directory for *.swp files
mkdir -p ~/.cache/vim-undo # directory for undo files
- # Check if YCM was updated and if so recompile
- if [ "$YCM_REV" != "$(cd $YCM_PATH && git --work-tree=. rev-parse HEAD)" ]; then (
- cd ~/.vim/bundle/YouCompleteMe
+ if [ "$YCM_REV" != "y" ]; then (
+ cd $YCM_PATH
./install.py --clang-completer --system-libclang --racer-completer
); else
echo "YouCompleteMe is not required to be recompiled"
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"