summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-01-08 21:23:24 -0500
committerBen Sima <ben@bsima.me>2021-01-08 23:06:47 -0500
commit3e8f9d2656c16f3f72157b776254f3649460dab8 (patch)
treecd5000773628cef985b60ed9f79b6722d49f51e9
parente36efd4269235feb976e089ce4bef08d0d76f4e3 (diff)
Simplify post-checkout
-rwxr-xr-xBiz/Ide/post-checkout19
1 files changed, 4 insertions, 15 deletions
diff --git a/Biz/Ide/post-checkout b/Biz/Ide/post-checkout
index 5474b5a..636fad6 100755
--- a/Biz/Ide/post-checkout
+++ b/Biz/Ide/post-checkout
@@ -1,28 +1,17 @@
#!/usr/bin/env bash
set -eu
-
-# Path to wherever you put this.
init_tags=$BIZ_ROOT/Biz/Ide/init_tags.sh
old=$1
new=$2
-# is_branch=$2 # 1 if branch, 2 if file
-# filter out only the changed files
-changed=($(git diff --name-only $old $new))
+# filter out only the changed haskell files
+changed=($(git diff --diff-filter=d --name-only $old $new -- '*.hs'))
if [[ ! -r tags ]]
then
$init_tags
-elif [[ ${#changed} -gt 0 ]]
+elif [[ ${#changed:-0} -gt 0 ]]
then
- grep -v -F --regexp=${^changed} $BIZ_ROOT/tags > $BIZ_ROOT/tags.tmp
- mv tags.tmp tags
-
- # Retag all hs files except the ones that were deleted.
- modified=($(git diff --name-only --diff-filter=d $old $new))
- # Filter *.hs, since grep returns non-zero for no matches.
- modified=(${(M)modified:#*.hs})
- echo "modified: $modified"
- $init_tags $modified
+ $init_tags $changed
fi