Skip to content

Commit 913b95d

Browse files
committed
meta: Changes to post-merge hook, only alert the user to changes
Running script in post-merge hooks breaks as soon as you try to run git checkout deep in a pre-run script somewhere
1 parent 0ee6470 commit 913b95d

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

.local/lib/apply-changes

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
# apply-changes v0.1
2-
# git post-merge hook to apply changes to the running environment after merging
3-
# from remote, attempts to re-run post-install scripts that have changed
1+
#!/usr/bin/env sh
42

3+
# apply-changes v0.2
4+
# git post-merge hook to denote changes to the running environment after
5+
# merging from remote, not attempting to run scripts in here because git gets
6+
# confused when it's called in pre-run scripts
7+
8+
str='\a\e[5;1;101m %s \e[0m\n'
9+
10+
script_change() {
11+
printf "$str" "Re-run ~/$1"
12+
}
513
restart_x() {
6-
printf '\e[1m%s\e[0m\n' 'Restart X session to apply changes to graphical shell'
14+
printf "$str" 'Restart X session to apply changes to graphical shell'
715
}
816
relogin() {
9-
printf '\e[1m%s\e[0m\n' 'Login again to apply changes to shell environment.'
17+
printf "$str" 'Login again to apply changes to shell environment.'
1018
}
1119

1220
IFS='
@@ -15,22 +23,20 @@ IFS='
1523
| while read -r file; do
1624
case "$file" in
1725
# changes to graphical shell
18-
.local/include/*|.config/dwm/*) ~/.once.d/10-git-upstream.sh; restart_x;;
26+
.local/include/*|.config/dwm/*) restart_x;;
1927
.config/*|.xinitrc|.xresources|Scripts/*) restart_x;;
2028

2129
# changes to shell environment
2230
.profile) relogin;;
2331

2432
# changes to installed packages
25-
.comforts) yes n | ~/.once.d/01-install-essential.sh;;
26-
.comforts-git|.config/upstream/*) ~/.once.d/10-git-upstream.sh;;
33+
.comforts) script_change .once.d/01-install-essential.sh;;
34+
.comforts-git|.config/upstream/*) script_change .once.d/10-git-upstream.sh;;
2735

2836
# changes to keyd
2937
.config/keyd/*) sudo systemctl restart keyd.service;;
3038

3139
# changes to post-install scripts
32-
.once.d/*) "$file";;
40+
.once.d/*) script_change "$file";;
3341
esac
34-
done
35-
36-
git meta diff --stat ORIG_HEAD..HEAD
42+
done | sort | uniq | nl

0 commit comments

Comments
 (0)