-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hooks: pre-commit hook to duplicate file
We have a file that's always a duplicate of another file, until we can get rid of this requirement a pre-commit hook to take care of it would be nice Signed-off-by: Omer Tuchfeld <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
SOURCE_FILE="training/ilab-wrapper/ilab" | ||
DEST_FILE="training/nvidia-bootc/duplicated/ilab-wrapper/ilab" | ||
|
||
if [[ -f "$SOURCE_FILE" ]]; then | ||
mkdir -p "$(dirname "$DEST_FILE")" | ||
cp "$SOURCE_FILE" "$DEST_FILE" | ||
git add "$DEST_FILE" | ||
else | ||
echo "Source file $SOURCE_FILE does not exist. Aborting commit." | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
HOOKS_DIR="hooks" | ||
GIT_HOOKS_DIR=".git/hooks" | ||
|
||
cp "$HOOKS_DIR/pre-commit" "$GIT_HOOKS_DIR/pre-commit" | ||
|
||
echo "Hooks installed successfully." |