Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
10dacbf0
Commit
10dacbf0
authored
Oct 14, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress errors from shallow clone detection
They are just noise.
parent
15dcdbd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
26 deletions
+7
-26
internal/git/git-http.go
internal/git/git-http.go
+1
-7
internal/git/pktline.go
internal/git/pktline.go
+4
-7
internal/git/pktline_test.go
internal/git/pktline_test.go
+2
-12
No files found.
internal/git/git-http.go
View file @
10dacbf0
...
...
@@ -125,14 +125,8 @@ func handlePostRPC(w http.ResponseWriter, r *http.Request, a *api.Response) {
return
}
isShallowClone
,
err
=
scanDeepen
(
bytes
.
NewReader
(
buffer
.
Bytes
()))
isShallowClone
=
scanDeepen
(
bytes
.
NewReader
(
buffer
.
Bytes
()))
body
=
io
.
MultiReader
(
buffer
,
r
.
Body
)
if
err
!=
nil
{
// Do not pass on the error: our failure to parse the
// request body should not abort the request.
helper
.
LogError
(
r
,
fmt
.
Errorf
(
"parseBody (non-fatal): %v"
,
err
))
}
}
else
{
body
=
r
.
Body
}
...
...
internal/git/pktline.go
View file @
10dacbf0
...
...
@@ -18,19 +18,16 @@ func pktFlush(w io.Writer) error {
return
err
}
func
scanDeepen
(
body
io
.
Reader
)
(
bool
,
error
)
{
hasDeepen
:=
false
func
scanDeepen
(
body
io
.
Reader
)
bool
{
scanner
:=
bufio
.
NewScanner
(
body
)
scanner
.
Split
(
pktLineSplitter
)
for
scanner
.
Scan
()
{
if
bytes
.
HasPrefix
(
scanner
.
Bytes
(),
[]
byte
(
"deepen"
))
{
hasDeepen
=
true
break
if
bytes
.
HasPrefix
(
scanner
.
Bytes
(),
[]
byte
(
"deepen"
))
&&
scanner
.
Err
()
==
nil
{
return
true
}
}
return
hasDeepen
,
scanner
.
Err
()
return
false
}
func
pktLineSplitter
(
data
[]
byte
,
atEOF
bool
)
(
advance
int
,
token
[]
byte
,
err
error
)
{
...
...
internal/git/pktline_test.go
View file @
10dacbf0
...
...
@@ -16,10 +16,7 @@ func TestSuccessfulScanDeepen(t *testing.T) {
}
for
_
,
example
:=
range
examples
{
hasDeepen
,
err
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
.
input
)))
if
err
!=
nil
{
t
.
Fatalf
(
"error scanning %q: %v"
,
example
.
input
,
err
)
}
hasDeepen
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
.
input
)))
if
hasDeepen
!=
example
.
output
{
t
.
Fatalf
(
"scanDeepen %q: expected %v, got %v"
,
example
.
input
,
example
.
output
,
hasDeepen
)
...
...
@@ -35,14 +32,7 @@ func TestFailedScanDeepen(t *testing.T) {
}
for
_
,
example
:=
range
examples
{
hasDeepen
,
err
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
)))
if
err
==
nil
{
t
.
Fatalf
(
"expected error scanning %q"
,
example
)
}
t
.
Log
(
err
)
if
hasDeepen
==
true
{
if
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
)))
==
true
{
t
.
Fatalf
(
"scanDeepen %q: expected result to be false, got true"
,
example
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment