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
Léo-Paul Géneau
gitlab-ce
Commits
47c844bf
Commit
47c844bf
authored
Jul 12, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gitaly notes and annotations to Gitlab::Git
parent
571c4f5a
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
66 additions
and
0 deletions
+66
-0
lib/gitlab/git/attributes.rb
lib/gitlab/git/attributes.rb
+5
-0
lib/gitlab/git/blame.rb
lib/gitlab/git/blame.rb
+3
-0
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+4
-0
lib/gitlab/git/blob_snippet.rb
lib/gitlab/git/blob_snippet.rb
+2
-0
lib/gitlab/git/branch.rb
lib/gitlab/git/branch.rb
+2
-0
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+4
-0
lib/gitlab/git/commit_stats.rb
lib/gitlab/git/commit_stats.rb
+4
-0
lib/gitlab/git/compare.rb
lib/gitlab/git/compare.rb
+2
-0
lib/gitlab/git/diff_collection.rb
lib/gitlab/git/diff_collection.rb
+2
-0
lib/gitlab/git/env.rb
lib/gitlab/git/env.rb
+2
-0
lib/gitlab/git/gitmodules_parser.rb
lib/gitlab/git/gitmodules_parser.rb
+2
-0
lib/gitlab/git/hook.rb
lib/gitlab/git/hook.rb
+4
-0
lib/gitlab/git/index.rb
lib/gitlab/git/index.rb
+4
-0
lib/gitlab/git/path_helper.rb
lib/gitlab/git/path_helper.rb
+2
-0
lib/gitlab/git/popen.rb
lib/gitlab/git/popen.rb
+2
-0
lib/gitlab/git/ref.rb
lib/gitlab/git/ref.rb
+3
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+5
-0
lib/gitlab/git/rev_list.rb
lib/gitlab/git/rev_list.rb
+4
-0
lib/gitlab/git/tag.rb
lib/gitlab/git/tag.rb
+2
-0
lib/gitlab/git/tree.rb
lib/gitlab/git/tree.rb
+6
-0
lib/gitlab/git/util.rb
lib/gitlab/git/util.rb
+2
-0
No files found.
lib/gitlab/git/attributes.rb
View file @
47c844bf
# Gitaly note: JV: not sure what to make of this class. Why does it use
# the full disk path of the repository to look up attributes This is
# problematic in Gitaly, because Gitaly hides the full disk path to the
# repository from gitlab-ce.
module
Gitlab
module
Gitlab
module
Git
module
Git
# Class for parsing Git attribute files and extracting the attributes for
# Class for parsing Git attribute files and extracting the attributes for
...
...
lib/gitlab/git/blame.rb
View file @
47c844bf
# Gitaly note: JV: needs 1 RPC for #load_blame.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Blame
class
Blame
...
@@ -24,6 +26,7 @@ module Gitlab
...
@@ -24,6 +26,7 @@ module Gitlab
private
private
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/376
def
load_blame
def
load_blame
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
@repo
.
path
}
blame -p
#{
@sha
}
--
#{
@path
}
)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
@repo
.
path
}
blame -p
#{
@sha
}
--
#{
@path
}
)
# Read in binary mode to ensure ASCII-8BIT
# Read in binary mode to ensure ASCII-8BIT
...
...
lib/gitlab/git/blob.rb
View file @
47c844bf
# Gitaly note: JV: seems to be completely migrated (behind feature flags).
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Blob
class
Blob
...
@@ -107,6 +109,8 @@ module Gitlab
...
@@ -107,6 +109,8 @@ module Gitlab
detect
&&
detect
[
:type
]
==
:binary
detect
&&
detect
[
:type
]
==
:binary
end
end
private
# Recursive search of blob id by path
# Recursive search of blob id by path
#
#
# Ex.
# Ex.
...
...
lib/gitlab/git/blob_snippet.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
BlobSnippet
class
BlobSnippet
...
...
lib/gitlab/git/branch.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Branch
<
Ref
class
Branch
<
Ref
...
...
lib/gitlab/git/commit.rb
View file @
47c844bf
...
@@ -48,6 +48,7 @@ module Gitlab
...
@@ -48,6 +48,7 @@ module Gitlab
#
#
# Commit.find(repo, 'master')
# Commit.find(repo, 'master')
#
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/321
def
find
(
repo
,
commit_id
=
"HEAD"
)
def
find
(
repo
,
commit_id
=
"HEAD"
)
return
commit_id
if
commit_id
.
is_a?
(
Gitlab
::
Git
::
Commit
)
return
commit_id
if
commit_id
.
is_a?
(
Gitlab
::
Git
::
Commit
)
return
decorate
(
commit_id
)
if
commit_id
.
is_a?
(
Rugged
::
Commit
)
return
decorate
(
commit_id
)
if
commit_id
.
is_a?
(
Rugged
::
Commit
)
...
@@ -124,6 +125,7 @@ module Gitlab
...
@@ -124,6 +125,7 @@ module Gitlab
# are documented here:
# are documented here:
# http://www.rubydoc.info/github/libgit2/rugged/Rugged#SORT_NONE-constant)
# http://www.rubydoc.info/github/libgit2/rugged/Rugged#SORT_NONE-constant)
#
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/326
def
find_all
(
repo
,
options
=
{})
def
find_all
(
repo
,
options
=
{})
actual_options
=
options
.
dup
actual_options
=
options
.
dup
...
@@ -243,6 +245,8 @@ module Gitlab
...
@@ -243,6 +245,8 @@ module Gitlab
# Shows the diff between the commit's parent and the commit.
# Shows the diff between the commit's parent and the commit.
#
#
# Cuts out the header and stats from #to_patch and returns only the diff.
# Cuts out the header and stats from #to_patch and returns only the diff.
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/324
def
to_diff
def
to_diff
diff_from_parent
.
patch
diff_from_parent
.
patch
end
end
...
...
lib/gitlab/git/commit_stats.rb
View file @
47c844bf
# Gitaly note: JV: 1 RPC, migration in progress.
# Gitlab::Git::CommitStats counts the additions, deletions, and total changes
# Gitlab::Git::CommitStats counts the additions, deletions, and total changes
# in a commit.
# in a commit.
module
Gitlab
module
Gitlab
...
@@ -6,6 +8,8 @@ module Gitlab
...
@@ -6,6 +8,8 @@ module Gitlab
attr_reader
:id
,
:additions
,
:deletions
,
:total
attr_reader
:id
,
:additions
,
:deletions
,
:total
# Instantiate a CommitStats object
# Instantiate a CommitStats object
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/323
def
initialize
(
commit
)
def
initialize
(
commit
)
@id
=
commit
.
id
@id
=
commit
.
id
@additions
=
0
@additions
=
0
...
...
lib/gitlab/git/compare.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Compare
class
Compare
...
...
lib/gitlab/git/diff_collection.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
DiffCollection
class
DiffCollection
...
...
lib/gitlab/git/env.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
# Ephemeral (per request) storage for environment variables that some Git
# Ephemeral (per request) storage for environment variables that some Git
...
...
lib/gitlab/git/gitmodules_parser.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
GitmodulesParser
class
GitmodulesParser
...
...
lib/gitlab/git/hook.rb
View file @
47c844bf
# Gitaly note: JV: looks like this is only used by GitHooksService in
# app/services. We shouldn't bother migrating this until we know how
# GitHooksService will be migrated.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Hook
class
Hook
...
...
lib/gitlab/git/index.rb
View file @
47c844bf
# Gitaly note: JV: When the time comes I think we will want to copy this
# class into Gitaly. None of its methods look like they should be RPC's.
# The RPC's will be at a higher level.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Index
class
Index
...
...
lib/gitlab/git/path_helper.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
PathHelper
class
PathHelper
...
...
lib/gitlab/git/popen.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
require
'open3'
require
'open3'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/git/ref.rb
View file @
47c844bf
# Gitaly note: JV: probably no RPC's here (just one interaction with Rugged).
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Ref
class
Ref
...
@@ -24,6 +26,7 @@ module Gitlab
...
@@ -24,6 +26,7 @@ module Gitlab
str
.
gsub
(
/\Arefs\/heads\//
,
''
)
str
.
gsub
(
/\Arefs\/heads\//
,
''
)
end
end
# Gitaly: this method will probably be migrated indirectly via its call sites.
def
self
.
dereference_object
(
object
)
def
self
.
dereference_object
(
object
)
object
=
object
.
target
while
object
.
is_a?
(
Rugged
::
Tag
::
Annotation
)
object
=
object
.
target
while
object
.
is_a?
(
Rugged
::
Tag
::
Annotation
)
...
...
lib/gitlab/git/repository.rb
View file @
47c844bf
...
@@ -553,6 +553,7 @@ module Gitlab
...
@@ -553,6 +553,7 @@ module Gitlab
# @repository.submodule_url_for('master', 'rack')
# @repository.submodule_url_for('master', 'rack')
# # => git@localhost:rack.git
# # => git@localhost:rack.git
#
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/329
def
submodule_url_for
(
ref
,
path
)
def
submodule_url_for
(
ref
,
path
)
Gitlab
::
GitalyClient
.
migrate
(
:submodule_url_for
)
do
|
is_enabled
|
Gitlab
::
GitalyClient
.
migrate
(
:submodule_url_for
)
do
|
is_enabled
|
if
is_enabled
if
is_enabled
...
@@ -567,6 +568,8 @@ module Gitlab
...
@@ -567,6 +568,8 @@ module Gitlab
end
end
# Return total commits count accessible from passed ref
# Return total commits count accessible from passed ref
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/330
def
commit_count
(
ref
)
def
commit_count
(
ref
)
gitaly_migrate
(
:commit_count
)
do
|
is_enabled
|
gitaly_migrate
(
:commit_count
)
do
|
is_enabled
|
if
is_enabled
if
is_enabled
...
@@ -838,6 +841,7 @@ module Gitlab
...
@@ -838,6 +841,7 @@ module Gitlab
# Ex.
# Ex.
# repo.ls_files('master')
# repo.ls_files('master')
#
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/327
def
ls_files
(
ref
)
def
ls_files
(
ref
)
actual_ref
=
ref
||
root_ref
actual_ref
=
ref
||
root_ref
...
@@ -864,6 +868,7 @@ module Gitlab
...
@@ -864,6 +868,7 @@ module Gitlab
raw_output
.
compact
raw_output
.
compact
end
end
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/328
def
copy_gitattributes
(
ref
)
def
copy_gitattributes
(
ref
)
begin
begin
commit
=
lookup
(
ref
)
commit
=
lookup
(
ref
)
...
...
lib/gitlab/git/rev_list.rb
View file @
47c844bf
# Gitaly note: JV: will probably be migrated indirectly by migrating the call sites.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
RevList
class
RevList
...
@@ -15,6 +17,8 @@ module Gitlab
...
@@ -15,6 +17,8 @@ module Gitlab
end
end
# This methods returns an array of missed references
# This methods returns an array of missed references
#
# Should become obsolete after https://gitlab.com/gitlab-org/gitaly/issues/348.
def
missed_ref
def
missed_ref
execute
([
*
base_args
,
'--max-count=1'
,
oldrev
,
"^
#{
newrev
}
"
])
execute
([
*
base_args
,
'--max-count=1'
,
oldrev
,
"^
#{
newrev
}
"
])
end
end
...
...
lib/gitlab/git/tag.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
#
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Tag
<
Ref
class
Tag
<
Ref
...
...
lib/gitlab/git/tree.rb
View file @
47c844bf
# Gitaly note: JV: needs 1 RPC, migration is in progress.
module
Gitlab
module
Gitlab
module
Git
module
Git
class
Tree
class
Tree
...
@@ -10,6 +12,8 @@ module Gitlab
...
@@ -10,6 +12,8 @@ module Gitlab
# Get list of tree objects
# Get list of tree objects
# for repository based on commit sha and path
# for repository based on commit sha and path
# Uses rugged for raw objects
# Uses rugged for raw objects
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/320
def
where
(
repository
,
sha
,
path
=
nil
)
def
where
(
repository
,
sha
,
path
=
nil
)
path
=
nil
if
path
==
''
||
path
==
'/'
path
=
nil
if
path
==
''
||
path
==
'/'
...
@@ -40,6 +44,8 @@ module Gitlab
...
@@ -40,6 +44,8 @@ module Gitlab
end
end
end
end
private
# Recursive search of tree id for path
# Recursive search of tree id for path
#
#
# Ex.
# Ex.
...
...
lib/gitlab/git/util.rb
View file @
47c844bf
# Gitaly note: JV: no RPC's here.
module
Gitlab
module
Gitlab
module
Git
module
Git
module
Util
module
Util
...
...
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