Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Devcontainers do not work with git worktree

Đang mở
#350 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
git, python

Hướng nghiên cứu

Tái hiện sự cố bằng git worktree add ../blueapi-enum add-enum-for-endpoint, sau đó mở worktree trong devcontainer của nó và chạy uv sync. Kiểm tra cấu hình devcontainer và cách xử lý .git của worktree; công việc được xem là hoàn tất khi các lệnh Git và uv sync hoạt động từ worktree đã mở mà không có các lỗi repository hoặc setuptools-scm đã được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Way to replicate this issue

  1. In a cloned repository add a worktree by
git worktree add ../blueapi-enum add-enum-for-endpoint

You will see that inside the worktree the .git has a link to the parent and not the

gitdir: /scratch/ckk43848/blueapi/.git/worktrees/blueapi-enum
  1. Open the blueapi-enum in devcontainer
    See the following issues
fatal: not a git repository: /scratch/ckk43848/blueapi/.git/worktrees/blueapi-enum

uv sync issue

root ➜ /workspaces/blueapi-enum 
$ uv sync
Resolved 274 packages in 0.90ms
  × Failed to build `blueapi @ file:///workspaces/blueapi-enum`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_editable` failed (exit status: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 481, in get_requires_for_build_editable
          return self.get_requires_for_build_wheel(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)  # type: ignore[return-value]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 148, in setup
          _setup_distribution = dist = klass(attrs)
                                       ^^^^^^^^^^^^
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/dist.py", line 321, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 307, in __init__
          self.finalize_options()
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/dist.py", line 790, in finalize_options
          ep(self)
        File "/root/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/contextlib.py", line 81, in inner
          return func(*args, **kwds)
                 ^^^^^^^^^^^^^^^^^^^
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 203, in infer_version
          _infer_version_impl(
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 236, in _infer_version_impl
          result.apply(dist)
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/version_inference.py", line 183, in apply
          data = infer_version_with_config(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/version_inference.py", line 123, in
      infer_version_with_config
          _version_missing(config, tool=env.tool_names[0])
        File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/vcs_versioning/_get_version_impl.py", line 263, in _version_missing
          raise LookupError(error_msg)
      LookupError: setuptools-scm was unable to detect version for /workspaces/blueapi-enum.

      Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout
      without the .git folder) don't contain the necessary metadata and will not work.

      For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj

      Alternatively, set the version with the environment variable SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${NORMALIZED_DIST_NAME} as described in
      https://setuptools-scm.readthedocs.io/en/latest/config/


hint: Build failures usually indicate a problem with the package or the build environmen

Possible solution:

Try to mount the parent as well when devcontainer knows that it is a worktree

Ngôn ngữ chính
Jinja
Star
25
Fork
10
Merge trung bình
4 ngày 17 giờ
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DiamondLightSource/python-copier-template

Tất cả issue của DiamondLightSource/python-copier-template

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.