Skip to content
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

pre-commit hook broken for git worktrees #1327

Closed
biddisco opened this issue Nov 13, 2024 · 0 comments · Fixed by #1328
Closed

pre-commit hook broken for git worktrees #1327

biddisco opened this issue Nov 13, 2024 · 0 comments · Fixed by #1328
Milestone

Comments

@biddisco
Copy link
Contributor

PR #1307 introduced podman to perform format checks using a podman image, but the mounting of the source tree inside the container doesn't work as is for git worktrees
for example, my own setup has a number of branches checked out in different trees as follows

elf:~/src/pika/workdir (transform-mpi-lifetimes *$%=): git worktree list
/home/biddisco/src/pika/main                 5827d3a5a655 [main]
/home/biddisco/src/pika/background_threads   74f62b8c112b [background_threads]
/home/biddisco/src/pika/clangformat          318f199d4207 [stringformat]
/home/biddisco/src/pika/cmake_vars           6fb345f34143 [cmake_vars]
/home/biddisco/src/pika/condition_variables  8fff8240051e [condition_variables]
/home/biddisco/src/pika/debug_fmt            3502e9b62ca2 [debug_fmt]
/home/biddisco/src/pika/limiting_scheduler   df3a70046eca [limiting_scheduler]
/home/biddisco/src/pika/moodycamel           9ca5a0afcfca [boost]
/home/biddisco/src/pika/mpi                  ba27a20e7696 [cuda-annotation]
/home/biddisco/src/pika/workdir              38328c003c44 [transform-mpi-lifetimes]

but the .git entry in 9 out of the 10 is really just a path to follow to find the real .git folder

elf:~/src/pika/workdir (transform-mpi-lifetimes *$%=): cat /home/biddisco/src/pika/mpi/.git
gitdir: ../main/.git/worktrees/mpi

and only the "main" (actually first, not necessarily main branch) tree created contains the real .git folder. When mounting the source tree and then executing git commands from the hook, unfortunately, the actual git folder is not mounted and so commands fail.

@biddisco biddisco changed the title pre-commit hook broekn for git worktrees pre-commit hook broken for git worktrees Nov 13, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in pika planning board Nov 13, 2024
@msimberg msimberg added this to the 0.31.0 milestone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants