Description
When starting the devcontainer from a worktree I get the following error message
[6554 ms] Start: Run in container: /bin/sh -c bash /devcontainer/features/s-core-local/enable_pre_commit_hooks.sh
Running Setup persistent bash history of postCreateCommand from Feature './s-core-local'...
Pre-commit configuration found (.pre-commit-config.yaml)
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/lurtz/.cache/pre-commit/pre-commit.log
[6966 ms] Enable pre-commit hooks of postCreateCommand from Feature './s-core-local' failed with exit code 1. Skipping any further user-provided commands.
Analysis results
At worktrees .git is not a directory, but a file with a line pointing to the original git checkout. enable_pre_commit_hooks.sh assumes to be always run from a directory containing a .git/ directory and thus fails in this case.
Solution
enable_pre_commit_hooks.sh should check if .git is a directory and only install pre-commit hooks, if it is.
Error Occurrence Rate
Reproducible
How to reproduce
Checkout a repo using the devcontianer, e.g. inc_someip_gateway
git worktree add ../some_path
cd ../some_path
code .
press reopen in container
Supporting Information
No response
Classification
Minor
First Affected Release
not released (main)
Last Affected Release
not released (main)
Expected Fixed Release
before release (main)
Category
Description
When starting the devcontainer from a worktree I get the following error message
Analysis results
At worktrees
.gitis not a directory, but a file with a line pointing to the original git checkout. enable_pre_commit_hooks.sh assumes to be always run from a directory containing a.git/directory and thus fails in this case.Solution
enable_pre_commit_hooks.sh should check if
.gitis a directory and only install pre-commit hooks, if it is.Error Occurrence Rate
Reproducible
How to reproduce
Checkout a repo using the devcontianer, e.g. inc_someip_gateway
press
reopen in containerSupporting Information
No response
Classification
Minor
First Affected Release
not released (main)
Last Affected Release
not released (main)
Expected Fixed Release
before release (main)
Category