aboutsummaryrefslogtreecommitdiff
path: root/lib/subcommands/pull.bash
diff options
context:
space:
mode:
Diffstat (limited to 'lib/subcommands/pull.bash')
-rw-r--r--lib/subcommands/pull.bash11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/subcommands/pull.bash b/lib/subcommands/pull.bash
index 4061f1b..42a51e1 100644
--- a/lib/subcommands/pull.bash
+++ b/lib/subcommands/pull.bash
@@ -6,10 +6,17 @@
subcommand()
{
+ local dirty
+
notice "bashtard/pull" "Pulling latest changes in $BASHTARD_ETCDIR"
- git -C "$BASHTARD_ETCDIR" stash
+ if ! git -C "$BASHTARD_ETCDIR" diff-index --quiet HEAD --
+ then
+ dirty=1
+ fi
+
+ [[ -n $dirty ]] && git -C "$BASHTARD_ETCDIR" stash
git -C "$BASHTARD_ETCDIR" pull origin master || return 4
git -C "$BASHTARD_ETCDIR" submodule update --recursive --remote || return 4
- git -C "$BASHTARD_ETCDIR" stash pop
+ [[ -n $dirty ]] && git -C "$BASHTARD_ETCDIR" stash pop
}