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
0decf974
Commit
0decf974
authored
Sep 21, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle EEXIST when finalizing git archive
Closes
https://gitlab.com/gitlab-org/gitlab-workhorse/issues/63
parent
06632c75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
internal/git/archive.go
internal/git/archive.go
+5
-1
internal/git/archive_test.go
internal/git/archive_test.go
+15
-0
No files found.
internal/git/archive.go
View file @
0decf974
...
...
@@ -173,7 +173,11 @@ func finalizeCachedArchive(tempFile *os.File, archivePath string) error {
if
err
:=
tempFile
.
Close
();
err
!=
nil
{
return
err
}
return
os
.
Link
(
tempFile
.
Name
(),
archivePath
)
if
err
:=
os
.
Link
(
tempFile
.
Name
(),
archivePath
);
err
!=
nil
&&
!
os
.
IsExist
(
err
)
{
return
err
}
return
nil
}
func
parseBasename
(
basename
string
)
(
string
,
bool
)
{
...
...
internal/git/archive_test.go
View file @
0decf974
package
git
import
(
"io/ioutil"
"testing"
)
...
...
@@ -27,3 +28,17 @@ func TestParseBasename(t *testing.T) {
}
}
}
func
TestFinalizeArchive
(
t
*
testing
.
T
)
{
tempFile
,
err
:=
ioutil
.
TempFile
(
""
,
"gitlab-workhorse-test"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
tempFile
.
Close
()
// Deliberately cause an EEXIST error: we know tempFile.Name() already exists
err
=
finalizeCachedArchive
(
tempFile
,
tempFile
.
Name
())
if
err
!=
nil
{
t
.
Fatalf
(
"expected nil from finalizeCachedArchive, received %v"
,
err
)
}
}
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