-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
#!bin/bash | ||
../install.sh | ||
|
||
#!/bin/bash | ||
|
||
# Determine the directory of this hook | ||
HOOK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Check if we are in a submodule setup | ||
if [ -f "$HOOK_DIR/gitmodules" ]; then | ||
# We're in a superproject's .git/modules directory, so navigate up to the submodule's root | ||
SUBMODULE_ROOT="$(dirname "$HOOK_DIR")/../../../$(basename "$HOOK_DIR")" | ||
else | ||
# We're in a normal repo, so just go up one level to the repo root | ||
SUBMODULE_ROOT="$(dirname "$HOOK_DIR")/.." | ||
fi | ||
|
||
# Path to install.sh relative to the repo/submodule root | ||
INSTALL_SCRIPT="$SUBMODULE_ROOT/install.sh" | ||
|
||
# Check if install.sh exists and is executable | ||
if [ -x "$INSTALL_SCRIPT" ]; then | ||
# Run the install script with the arguments passed to the hook | ||
"$INSTALL_SCRIPT" "$@" | ||
else | ||
echo "Warning: install.sh not found or not executable at $INSTALL_SCRIPT" >&2 | ||
fi |