Skip to content

Fix docker-generate in git worktrees#1387

Merged
MrAlias merged 1 commit into
open-telemetry:mainfrom
skl:skl/fix-docker-generate-worktree
Mar 2, 2026
Merged

Fix docker-generate in git worktrees#1387
MrAlias merged 1 commit into
open-telemetry:mainfrom
skl:skl/fix-docker-generate-worktree

Conversation

@skl
Copy link
Copy Markdown
Member

@skl skl commented Mar 2, 2026

Summary

Fixes make docker-generate failing with fatal: not a git repository when run from a git worktree. The root cause is that .git is a file (not a directory) in worktrees, pointing to the real git directory outside the container mount.

The fix mounts the resolved git common directory into the container and sets GIT_DIR to point to the worktree-specific git directory within it. This allows git commands to work correctly regardless of whether the code is run from a normal clone, a submodule, or a worktree.

Verification

  • make docker-generate now runs without fatal: errors in worktrees
  • Git commands (git describe, git rev-parse) execute correctly inside the container
  • Generated eBPF files are produced correctly

Checklist

Mount the resolved git common directory into the container and set GIT_DIR
to point to the worktree-specific git directory within it. This allows git
commands to work correctly inside the container when running from a worktree,
where .git is a file (not a directory) that references the worktree's git
directory outside the CURDIR mount.

The fix resolves relative paths like ../.. in the git 'commondir' file,
making it work for all cases: normal clones, submodules, and worktrees.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@skl skl requested a review from a team as a code owner March 2, 2026 12:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.63%. Comparing base (9d82c97) to head (b792b67).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1387      +/-   ##
==========================================
+ Coverage   43.74%   44.63%   +0.89%     
==========================================
  Files         312      311       -1     
  Lines       33911    28681    -5230     
==========================================
- Hits        14834    12803    -2031     
+ Misses      18120    15103    -3017     
+ Partials      957      775     -182     
Flag Coverage Δ
integration-test ?
integration-test-arm ?
integration-test-vm-x86_64-5.15.152 ?
integration-test-vm-x86_64-6.10.6 ?
k8s-integration-test ?
oats-test ?
unittests 44.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@NimrodAvni78 NimrodAvni78 left a comment

Choose a reason for hiding this comment

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

Nice!

@MrAlias MrAlias merged commit 6f6323c into open-telemetry:main Mar 2, 2026
15 checks passed
@skl skl deleted the skl/fix-docker-generate-worktree branch March 2, 2026 15:25
@MrAlias MrAlias added this to the v0.6.0 milestone Mar 2, 2026
@MrAlias MrAlias mentioned this pull request Mar 5, 2026
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.

4 participants