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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
103750f1
Commit
103750f1
authored
Oct 07, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass ArchivePrefix from authBackend
parent
4d645003
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
githandler.go
githandler.go
+7
-7
main_test.go
main_test.go
+12
-1
No files found.
githandler.go
View file @
103750f1
...
...
@@ -36,6 +36,7 @@ type gitEnv struct {
GL_ID
string
RepoPath
string
ArchivePath
string
ArchivePrefix
string
CommitId
string
}
...
...
@@ -222,9 +223,8 @@ func handleGetArchive(env gitEnv, format string, repoPath string, w http.Respons
}
archiveFilename
:=
path
.
Base
(
env
.
ArchivePath
)
archivePrefix
:=
strings
.
TrimSuffix
(
archiveFilename
,
"."
+
format
)
+
"/"
archiveCmd
:=
gitCommand
(
env
,
"git"
,
"--git-dir="
+
repoPath
,
"archive"
,
"--format="
+
archiveFormat
,
"--prefix="
+
archivePrefix
,
env
.
CommitId
)
archiveCmd
:=
gitCommand
(
env
,
"git"
,
"--git-dir="
+
repoPath
,
"archive"
,
"--format="
+
archiveFormat
,
"--prefix="
+
env
.
ArchivePrefix
+
"/"
,
env
.
CommitId
)
archiveStdout
,
err
:=
archiveCmd
.
StdoutPipe
()
if
err
!=
nil
{
fail500
(
w
,
"handleGetArchive"
,
err
)
...
...
main_test.go
View file @
103750f1
...
...
@@ -260,7 +260,18 @@ func gitOkBody(t *testing.T) string {
}
func
archiveOkBody
(
t
*
testing
.
T
,
archiveName
string
)
string
{
return
fmt
.
Sprintf
(
`{"RepoPath":"%s","ArchivePath":"/tmp/%s","CommitId":"c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd"}`
,
repoPath
(
t
),
archiveName
)
cwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
archivePath
:=
path
.
Join
(
cwd
,
scratchDir
,
"cache"
,
archiveName
)
jsonString
:=
`{
"RepoPath":"%s",
"ArchivePath":"/tmp/%s",
"CommitId":"c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd",
"ArchivePrefix":"foobar123"
}`
return
fmt
.
Sprintf
(
jsonString
,
repoPath
(
t
),
archivePath
)
}
func
repoPath
(
t
*
testing
.
T
)
string
{
...
...
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