-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathfupgrade
More file actions
executable file
·55 lines (45 loc) · 1.06 KB
/
Copy pathfupgrade
File metadata and controls
executable file
·55 lines (45 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
#
# update dotbare to latest master
set -f
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function usage() {
echo -e "Usage: dotbare fupgrade [-h] ...
Upgrade dotbare to the latest master.
Optional arguments:
-h, --help\t\tshow this help message and exit."
}
while [[ "$#" -gt 0 ]]; do
case "$1" in
-h|--help)
usage
exit 0
;;
*)
echo "Invalid option: $1" >&2
usage
exit 1
;;
esac
done
# rip from omz
# auto stash on rebase
resetAutoStash=$(git config --bool rebase.autoStash 2>&1)
git config rebase.autoStash true
# change directory to dotbare folder
cd "${mydir}/.." || exit
echo "Updating dotbare ..."
if git pull --rebase --stat origin master; then
echo "dotbare updated successfully"
else
echo "Something went wrong, please try again or fire up an issue at https://github.com/kazhala/dotbare"
fi
# reset autostack to original value
case "$resetAutoStash" in
"")
git config --unset rebase.autoStash
;;
*)
git config rebase.autoStash "${resetAutoStash}"
;;
esac