Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
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
Boxiang Sun
gitlab-ce
Commits
728d7e0c
Commit
728d7e0c
authored
Jan 22, 2018
by
Kim "BKC" Carlbäcker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move error-handling to lib/gitlab/git
parent
58aa32bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
app/models/repository.rb
app/models/repository.rb
+1
-11
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+4
-2
No files found.
app/models/repository.rb
View file @
728d7e0c
...
...
@@ -259,17 +259,7 @@ class Repository
return
if
kept_around?
(
sha
)
# This will still fail if the file is corrupted (e.g. 0 bytes)
begin
raw_repository
.
write_ref
(
keep_around_ref_name
(
sha
),
sha
,
shell:
false
)
rescue
Gitlab
::
Git
::
CommandError
=>
ex
if
ex
.
message
.
start_with?
(
"ReferenceError: "
)
Rails
.
logger
.
error
"Unable to create
#{
REF_KEEP_AROUND
}
reference for repository
#{
path
}
:
#{
ex
}
"
elsif
ex
.
message
.
start_with?
(
"OSError: "
)
raise
unless
ex
.
message
=~
/Failed to create locked file/
&&
ex
.
message
=~
/File exists/
Rails
.
logger
.
error
"Unable to create
#{
REF_KEEP_AROUND
}
reference for repository
#{
path
}
:
#{
ex
}
"
end
end
raw_repository
.
write_ref
(
keep_around_ref_name
(
sha
),
sha
,
shell:
false
)
end
def
kept_around?
(
sha
)
...
...
lib/gitlab/git/repository.rb
View file @
728d7e0c
...
...
@@ -1395,9 +1395,11 @@ module Gitlab
def
rugged_write_ref
(
ref_path
,
ref
)
rugged
.
references
.
create
(
ref_path
,
ref
,
force:
true
)
rescue
Rugged
::
ReferenceError
=>
ex
raise
CommandError
,
"ReferenceError
:
#{
ex
}
"
Rails
.
logger
.
error
"Unable to create
#{
ref_path
}
reference for repository
#{
path
}
:
#{
ex
}
"
rescue
Rugged
::
OSError
=>
ex
raise
CommandError
,
"OSError:
#{
ex
}
"
raise
unless
ex
.
message
=~
/Failed to create locked file/
&&
ex
.
message
=~
/File exists/
Rails
.
logger
.
error
"Unable to create
#{
ref_path
}
reference for repository
#{
path
}
:
#{
ex
}
"
end
def
fresh_worktree?
(
path
)
...
...
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