File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
- [[ " $1 " ]] || \
2
+ [[ " $1 " == " source " ]] || \
3
3
4
4
echo ' Dotfiles - "Cowboy" Ben Alman - http://benalman.com/'
5
5
@@ -133,7 +133,7 @@ function to_install() {
133
133
}
134
134
135
135
# If this file was being sourced, exit now.
136
- [[ " $1 " ]] && return
136
+ [[ " $1 " == " source " ]] && return
137
137
138
138
139
139
# ##########################################
@@ -267,12 +267,14 @@ if [[ ! -d $DOTFILES ]]; then
267
267
e_header " Downloading dotfiles"
268
268
git clone --recursive git://github.com/${github_user:- cowboy} /dotfiles.git $DOTFILES
269
269
cd $DOTFILES
270
- else
270
+ elif [[ " $1 " != " restart " ]] ; then
271
271
# Make sure we have the latest files.
272
272
e_header " Updating dotfiles"
273
+ prev_head=" $( git rev-parse HEAD) "
273
274
cd $DOTFILES
274
275
git pull
275
276
git submodule update --init --recursive --quiet
277
+ [[ " $( git rev-parse HEAD) " != " $prev_head " ]] && exec " $0 " " restart"
276
278
fi
277
279
278
280
# Add binaries into the path
Original file line number Diff line number Diff line change 1
- # Passing an arg into dotfiles tells it to only define functions, then quit.
2
- source ~ /.dotfiles/bin/dotfiles 1
1
+ # Passing the "source" arg tells it to only define functions, then quit.
2
+ source ~ /.dotfiles/bin/dotfiles " source "
You can’t perform that action at this time.
0 commit comments