Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62a77b7

Browse files
plumbing: Fix invalid reference name error while cloning branches containing /- (#1257)
* plumbing: Fix invalid reference name error while cloning branches containing /-* Tests
1 parent65f5e1a commit62a77b7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎plumbing/reference.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (r ReferenceName) Validate() error {
188188

189189
isBranch:=r.IsBranch()
190190
isTag:=r.IsTag()
191-
for_,part:=rangeparts {
191+
fori,part:=rangeparts {
192192
// rule 6
193193
iflen(part)==0 {
194194
returnErrInvalidReferenceName
@@ -205,7 +205,7 @@ func (r ReferenceName) Validate() error {
205205
returnErrInvalidReferenceName
206206
}
207207

208-
if (isBranch||isTag)&&strings.HasPrefix(part,"-") {// branches & tags can't start with -
208+
if (isBranch||isTag)&&strings.HasPrefix(part,"-")&& (i==2){// branches & tags can't start with -
209209
returnErrInvalidReferenceName
210210
}
211211
}

‎plumbing/reference_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ func (s *ReferenceSuite) TestValidReferenceNames(c *C) {
115115
"refs/pulls/1/abc.123",
116116
"refs/pulls",
117117
"refs/-",// should this be allowed?
118+
"refs/ab/-testing",
119+
"refs/123-testing",
118120
}
119121
for_,v:=rangevalid {
120122
c.Assert(v.Validate(),IsNil)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp