Skip to content

Setup post-commit hook to withstand template based creations #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2025

Conversation

eljog
Copy link
Member

@eljog eljog commented Jul 10, 2025

Setup post-commit on postCreateCommand, because git directory may be reset if when the repo is used as template

@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 21:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reconfigures the post-commit hook setup to support template-based repository creation by moving the hook installation from build time to runtime. The key change addresses the issue where git hooks installed during the build process are lost when a repository is created from a template, since the .git directory gets reset.

  • Moves post-commit hook from direct installation to .git/hooks during build to a two-step process
  • Installs the hook script to a persistent location (/usr/local/bin) during build
  • Creates a symbolic link to the hook during container startup when .git directory is available

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.devcontainer/refreshTools.sh Changes post-commit hook installation to move script to /usr/local/bin instead of directly to .git/hooks
.devcontainer/postStartCommand.sh Adds symlink creation from /usr/local/bin/post-commit to .git/hooks/pre-push during container startup

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@eljog eljog merged commit 90e0b17 into main Jul 10, 2025
2 checks passed
@eljog eljog deleted the eljog/post-commit-placement branch July 10, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants