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
c111e8aa
Commit
c111e8aa
authored
Dec 08, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logError function
parent
d88bb4df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
archive.go
archive.go
+4
-4
git-http.go
git-http.go
+6
-7
helpers.go
helpers.go
+6
-2
No files found.
archive.go
View file @
c111e8aa
...
...
@@ -103,22 +103,22 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
setArchiveHeaders
(
w
,
format
,
archiveFilename
)
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
if
_
,
err
:=
io
.
Copy
(
w
,
archiveReader
);
err
!=
nil
{
log
.
Printf
(
"handleGetArchive: read: %v"
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetArchive: read: %v"
,
err
)
)
return
}
if
err
:=
archiveCmd
.
Wait
();
err
!=
nil
{
log
.
Printf
(
"handleGetArchive: archiveCmd: %v"
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetArchive: archiveCmd: %v"
,
err
)
)
return
}
if
compressCmd
!=
nil
{
if
err
:=
compressCmd
.
Wait
();
err
!=
nil
{
log
.
Printf
(
"handleGetArchive: compressCmd: %v"
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetArchive: compressCmd: %v"
,
err
)
)
return
}
}
if
err
:=
finalizeCachedArchive
(
tempFile
,
r
.
ArchivePath
);
err
!=
nil
{
log
.
Printf
(
"handleGetArchive: finalize cached archive: %v"
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetArchive: finalize cached archive: %v"
,
err
)
)
return
}
}
...
...
git-http.go
View file @
c111e8aa
...
...
@@ -7,7 +7,6 @@ package main
import
(
"fmt"
"io"
"log"
"net/http"
"path/filepath"
"strings"
...
...
@@ -40,19 +39,19 @@ func handleGetInfoRefs(w http.ResponseWriter, r *gitRequest) {
w
.
Header
()
.
Add
(
"Cache-Control"
,
"no-cache"
)
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
if
err
:=
pktLine
(
w
,
fmt
.
Sprintf
(
"# service=%s
\n
"
,
rpc
));
err
!=
nil
{
log
.
Printf
(
"handleGetInfoRefs: pktLine: %v"
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetInfoRefs: pktLine: %v"
,
err
)
)
return
}
if
err
:=
pktFlush
(
w
);
err
!=
nil
{
log
.
Printf
(
"handleGetInfoRefs: pktFlush: %v"
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetInfoRefs: pktFlush: %v"
,
err
)
)
return
}
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
log
.
Printf
(
"handleGetInfoRefs: read from %v: %v"
,
cmd
.
Args
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetInfoRefs: read from %v: %v"
,
cmd
.
Args
,
err
)
)
return
}
if
err
:=
cmd
.
Wait
();
err
!=
nil
{
log
.
Printf
(
"handleGetInfoRefs: wait for %v: %v"
,
cmd
.
Args
,
err
)
log
Error
(
fmt
.
Errorf
(
"handleGetInfoRefs: wait for %v: %v"
,
cmd
.
Args
,
err
)
)
return
}
}
...
...
@@ -107,11 +106,11 @@ func handlePostRPC(w http.ResponseWriter, r *gitRequest) {
// This io.Copy may take a long time, both for Git push and pull.
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
log
.
Printf
(
"handlePostRPC read from %v:%v"
,
cmd
.
Args
,
err
)
log
Error
(
fmt
.
Errorf
(
"handlePostRPC read from %v: %v"
,
cmd
.
Args
,
err
)
)
return
}
if
err
:=
cmd
.
Wait
();
err
!=
nil
{
log
.
Printf
(
"handlePostRPC wait for %v: %v"
,
cmd
.
Args
,
err
)
log
Error
(
fmt
.
Errorf
(
"handlePostRPC wait for %v: %v"
,
cmd
.
Args
,
err
)
)
return
}
}
...
...
helpers.go
View file @
c111e8aa
...
...
@@ -19,12 +19,16 @@ import (
func
fail400
(
w
http
.
ResponseWriter
,
err
error
)
{
http
.
Error
(
w
,
"Bad request"
,
400
)
log
.
Print
(
err
)
log
Error
(
err
)
}
func
fail500
(
w
http
.
ResponseWriter
,
err
error
)
{
http
.
Error
(
w
,
"Internal server error"
,
500
)
log
.
Print
(
err
)
logError
(
err
)
}
func
logError
(
err
error
)
{
log
.
Printf
(
"error: %v"
,
err
)
}
// Git subprocess helpers
...
...
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