jenkinsci / jenkinsci/git-client-plugin

[JENKINS-70303] JGit checkout fails if refspec has leading spaces

Đang mở
#1,663 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
component:git-client-plugin good first issue imported-jira-issue priority:minor resolution:unresolved
Ngôn ngữ chính
Java
Star
152
Fork
402
Merge trung bình
6 giờ 47 phút
Pull request đã merge (30 ngày)
4

Mô tả

If a refspec is included in the checkout scm definition of a multibranch Pipeline using JGit for checkout and the refspec has a leading space character, the checkout fails with the JGit message


Remote does not have available for fetch.

The same refspec with leading spaces does not affect command line git checkout. It works in either case with command line git. Leading space handling by command line git is preferred rather than the way that the git client plugin honors the leading spaces and passes them to JGit.

Command line git does not see the issue because extra spaces between arguments of a command line program are generally not an issue. Lucky circumstances that allow the CLI git checkout to be better behaved than the JGit checkout.

Because command line git accepts the leading and trailing spaces, it would be safe for someone to fix this by removing leading and trailing spaces from the refspec value when it is saved and when it is used.

---
Originally reported by markewaite, imported from: JGit checkout fails if refspec has leading spaces


  • assignee: jagrutiti
  • status: In Review
  • priority: Minor
  • component(s): git-client-plugin
  • label(s): newbie-friendly
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 20251211-071809

Raw content of original issue

If a refspec is included in the checkout scm definition of a multibranch Pipeline using JGit for checkout and the refspec has a leading space character, the checkout fails with the JGit message


Remote does not have available for fetch.

The same refspec with leading spaces does not affect command line git checkout. It works in either case with command line git. Leading space handling by command line git is preferred rather than the way that the git client plugin honors the leading spaces and passes them to JGit.

Command line git does not see the issue because extra spaces between arguments of a command line program are generally not an issue. Lucky circumstances that allow the CLI git checkout to be better behaved than the JGit checkout.

Because command line git accepts the leading and trailing spaces, it would be safe for someone to fix this by removing leading and trailing spaces from the refspec value when it is saved and when it is used.

environment

```
Jenknis 2.375.1

Git plugin 4.14.3

Git client plugin 3.13.1
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reproducing a multibranch Pipeline checkout with JGit and a refspec containing leading spaces, then compare it with command-line Git behavior. Trace how the git-client-plugin saves and uses the refspec; the work is done when leading and trailing spaces no longer cause the JGit checkout to fail.

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

Đánh giá

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

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.