-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsparse_checkout_staging.sh
More file actions
executable file
·37 lines (33 loc) · 1.04 KB
/
sparse_checkout_staging.sh
File metadata and controls
executable file
·37 lines (33 loc) · 1.04 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
#!/bin/zsh
DOTFILES_REPO="dotfiles"
vcsh $DOTFILES_REPO fetch >/dev/null
LAST_TAG=$(vcsh $DOTFILES_REPO describe --abbrev=0 --match 'sparse_checkout*')
ALL_TAGS=("${(@f)$(vcsh $DOTFILES_REPO tag --list 'sparse_checkout*')}")
typeset -a REMAINING_TAGS
for tag in $ALL_TAGS; do
if [[ $tag > $LAST_TAG && $tag != $LAST_TAG ]]; then
REMAINING_TAGS=( $REMAINING_TAGS $tag );
fi
done
unset tag
if [[ ${#REMAINING_TAGS[@]} -gt 0 ]]; then
for tag in $REMAINING_TAGS; do
echo "Checking out $tag for $DOTFILES_REPO:"
vcsh $DOTFILES_REPO checkout $tag >/dev/null && \
echo "Running upgrade for $DOTFILES_REPO:" && \
vcsh upgrade $DOTFILES_REPO
TEXT=$(cat <<-EOF
Check if upgrades were correctly replied and press enter to \
continue to any remaining tags.
EOF
)
# Adhering to 80 characters can be pretty shitty.
echo $TEXT
read
done
echo "You can safely upgrade to the current master branch (probably):"
echo "vcsh $DOTFILES_REPO checkout master"
echo "vcsh $DOTFILES_REPO pull"
else
echo "No new sparse checkout tags present, HAND."
fi