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
41b0c0e9
Commit
41b0c0e9
authored
Dec 08, 2017
by
Kim Carlbäcker
Committed by
Robert Speicher
Dec 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate Git::Repository#fsck to Gitaly
parent
22666b78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+16
-2
lib/gitlab/gitaly_client/repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+11
-0
No files found.
lib/gitlab/git/repository.rb
View file @
41b0c0e9
...
...
@@ -1160,9 +1160,15 @@ module Gitlab
end
def
fsck
output
,
status
=
run_git
(
%W[--git-dir=
#{
path
}
fsck]
,
nice:
true
)
gitaly_migrate
(
:git_fsck
)
do
|
is_enabled
|
msg
,
status
=
if
is_enabled
gitaly_fsck
else
shell_fsck
end
raise
GitError
.
new
(
"Could not fsck repository:
\n
#{
output
}
"
)
unless
status
.
zero?
raise
GitError
.
new
(
"Could not fsck repository:
#{
msg
}
"
)
unless
status
.
zero?
end
end
def
rebase
(
user
,
rebase_id
,
branch
:,
branch_sha
:,
remote_repository
:,
remote_branch
:)
...
...
@@ -1310,6 +1316,14 @@ module Gitlab
File
.
write
(
File
.
join
(
worktree_info_path
,
'sparse-checkout'
),
files
)
end
def
gitaly_fsck
gitaly_repository_client
.
fsck
end
def
shell_fsck
run_git
(
%W[--git-dir=
#{
path
}
fsck]
,
nice:
true
)
end
def
rugged_fetch_source_branch
(
source_repository
,
source_branch
,
local_ref
)
with_repo_branch_commit
(
source_repository
,
source_branch
)
do
|
commit
|
if
commit
...
...
lib/gitlab/gitaly_client/repository_service.rb
View file @
41b0c0e9
...
...
@@ -87,6 +87,17 @@ module Gitlab
response
.
result
end
def
fsck
request
=
Gitaly
::
FsckRequest
.
new
(
repository:
@gitaly_repo
)
response
=
GitalyClient
.
call
(
@storage
,
:repository_service
,
:fsck
,
request
)
if
response
.
error
.
empty?
return
""
,
0
else
return
response
.
error
.
b
,
1
end
end
end
end
end
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