Skip to content

Commit c7024aa

Browse files
committed
[Scripts] Skip core.hookspath reset for whitelisted repos in git fetch
funfair-treasury-reporting relies on a custom core.hookspath that should not be cleared when the repo-wide fetch script runs.
1 parent 3344c51 commit c7024aa

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

git/fetch

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ info() {
1313
printf '\n\033[32m→\033[0m %s\n' "$*"
1414
}
1515

16+
HOOKSPATH_RESET_WHITELIST_SKIP="funfair-treasury-reporting"
17+
18+
is_hookspath_reset_skipped() {
19+
repo_name=$(basename "$1")
20+
for skipped in $HOOKSPATH_RESET_WHITELIST_SKIP; do
21+
if [ "$repo_name" = "$skipped" ]; then
22+
return 0
23+
fi
24+
done
25+
return 1
26+
}
27+
1628
SWITCH_TO_MAIN=0
1729

1830
for arg in "$@"; do
@@ -31,7 +43,12 @@ do
3143
CURRENT_DIR=$line
3244

3345
info "Retrieving ${CURRENT_DIR}..."
34-
git -C "$CURRENT_DIR" config --local --unset core.hookspath 2>/dev/null || true
46+
if is_hookspath_reset_skipped "$CURRENT_DIR"
47+
then
48+
info "Skipping core.hookspath reset for ${CURRENT_DIR} (whitelisted)."
49+
else
50+
git -C "$CURRENT_DIR" config --local --unset core.hookspath 2>/dev/null || true
51+
fi
3552
git -C "$CURRENT_DIR" remote get-url origin 2>&1 || die "Could not determine origin for ${CURRENT_DIR}"
3653
git -C "$CURRENT_DIR" fetch --prune --prune-tags 2>&1 || die "Could not fetch ${CURRENT_DIR}"
3754
git -C "$CURRENT_DIR" remote update origin --prune 2>&1 || die "Could not update remote refs for ${CURRENT_DIR}"

0 commit comments

Comments
 (0)