Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit c0274ed

Browse files
author
Scott Morrison
committed
fix(scripts/cache-olean): only run the post-checkout hook if we actually changed branches
1 parent 25bab56 commit c0274ed

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/post-checkout

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/bin/sh
22
export PATH=$HOME/.mathlib/bin:$PATH
3-
# hooks are sometimes run from git GUIs with a limited environment
4-
# if python3 isn't available, we don't generate an error; just a message
5-
if /usr/bin/env python3 -c ""; then
3+
4+
OLD_HEAD=$1
5+
NEW_HEAD=$2
6+
CHANGED_BRANCH=$3
7+
8+
if [ "$CHANGED_BRANCH" -eq "1" ]; then
9+
# hooks are sometimes run from git GUIs with a limited environment
10+
# if python3 isn't available, we don't generate an error; just a message
11+
if /usr/bin/env python3 -c ""; then
612
echo "Trying to fetch cached olean"
713
cache-olean --fetch
8-
else
9-
echo "'env python3' failed; not running post-checkout hook"
14+
else
15+
echo "'env python3' failed; not running post-checkout hook"
16+
fi
1017
fi

0 commit comments

Comments
 (0)