Age | Commit message (Collapse) | Author |
|
Remove the now-unused gitaly-git2o command as well as its supporting
infrastructure.
|
|
When spawning gitaly-git2go processes, we redirect their stderr to print
to the writer used by our global logging mechanism. This should in the
general case be stderr of the Gitaly process, which means that any logs
would get spliced into the main logging stream generated by Gitaly.
The mechanism isn't great though, and we're about to get rid of the
global logging instance in favor of the injected ones. Given that this
is the last instance where we still rely on the global logger's internal
workings, and that the gitaly-git2go command is going away in a release
or two anyway, there is thus a strong urge to adapt it to unblock our
remaining logging refactorings.
And that's exactly what we do now. Instead of reaching into the global
logging instance to retrieve its writer, we simply construct a writer
from the logger and pass that to the newly created process. Now this has
the downside that we're unable to control the log level, and furthermore
it will cause the log messages themselves to be encoded in JSON again.
But as said, this is only a temporary measure that we can get rid of in
the near future by removing the complete gitaly-git2go command.
This change removes the last instance where we rely on our logger to be
a `logrus.Logger` and is also the last user of `log.Default()`.
|
|
The "internal/git2go" package still hosts a bunch of errors which are
used by the UserUpdateSubmodulie RPC and nothing else. Furthermore, two
of the three errors are actually never raised anymore, so there is no
point in handling them.
Move the single error that is still being used over to where its used.
|
|
The "internal/git2go" package still hosts a bunch of errors which are
used by the UserCommitFiles RPC and nothing else. Let's move them over
and make them private.
|
|
We have removed the feature flag that was guarding the Git based
implementation of UserCherryPick, which makes the Git2go-based
cherry-pick implementation unused. Remove it.
|
|
This reverts commit acfe013b5e5e7c3992a889058a73ec8f7f1b4de7, reversing
changes made to 023c2a7d02fa92926cb3db390357149e5ac1151c.
|
|
operations: Implement UserRebaseConfirmable in pure git
Closes #4579
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6176
Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Reviewed-by: Xing Xin <moweng.xx@alibaba-inc.com>
Reviewed-by: John Cai <jcai@gitlab.com>
Co-authored-by: Xing Xin <xingxin.xx@bytedance.com>
|
|
The type `Signature` is originally used by git2go to help generating
signatures for committer and author of a commit. The package git2go
would reach the end of its life so we should put `Signature` to a more
suitable package for future use.
And the declaration of `Signature` and `NewSignature` in git2go are kept
to avoid too many code changes.
Signed-off-by: Xing Xin <xingxin.xx@bytedance.com>
|
|
Now that we don't use git2go's cherry pick subcommand anywhere, let's
remove it.
|
|
operations Remove RevertPureGit feature flag
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6165
Merged-by: Will Chandler <wchandler@gitlab.com>
Approved-by: Will Chandler <wchandler@gitlab.com>
Reviewed-by: karthik nayak <knayak@gitlab.com>
Co-authored-by: John Cai <jcai@gitlab.com>
|
|
Now that git2go's revert is not called anywhere, remove it.
|
|
Now that Merge is no longer used anywhere in the codebase, let's remove
it.
|
|
Since `ResolveConflicts` RPC is now using a pure git implementation, we
can remove the unused git2go code.
|
|
The feature flags test for Git2go doesn't access any Git objects, so it
can be trivially enabled to test with SHA256.
|
|
The commit actions are still declared in the `internal/git2go` package
even though they have nothing to do with Git2go anymore. Let's move them
to their only site of usage, which is next to the `UserCommitFiles()`
implementation.
Note that we also rename the structure from `Action` to `commitAction`.
This is done to avoid local name conflicts.
|
|
In the preceding commit we have removed the implementation of the
"commit" subcommand. But as "commit.go" still contains a bunch of shared
error types we cannot remove that file yet, but it's name does not match
its contents anymore.
Rename it to "errors.go" to better reflect what it contains.
|
|
We have recently converted UserCommitFiles to stop using Git2go and
instead use plain Git, which was finalized via 69c6de1fb (operations:
Remove CommitFilesInGit feature flag, 2023-06-28). We couldn't remove
the "commit" subcommand from `gitaly-git2go` though because the "apply"
subcommand still depended on it. But now that the latter has been
removed we can also remove the "commit" subcommand now. Let's do so.
|
|
The "apply" subcommand has never really been used in production due to a
bug in libgit2 that causes certain patches to misapply. As we have never
been able to get the fix upstreamed, we were barred from using libgit2
here and instead still continue to use a worktree and git-apply(1). As
we have essentially deprecated libgit2, this is also not going to change
either.
We still had a dependency on the "apply" subcommand in our tests for
RawDiff and RawPatch. These have been refactored now though, removing
the last usage of the command. So let's drop the implementation of the
"apply" subcommand altogether.
|
|
Extend GetCommitSignatures to return Signer
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5961
Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Reviewed-by: Igor Drozdov <idrozdov@gitlab.com>
Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Reviewed-by: Will Chandler <wchandler@gitlab.com>
Co-authored-by: Igor Drozdov <idrozdov@gitlab.com>
|
|
This function verifies the signature and checks whether it's
been signed by the signing key
|
|
Now that we are no longer calling Git2Go submodule anywhere, we can
remove all the code except for the error messages we still rely on.
|
|
Move SSH signing function to library
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5960
Merged-by: Will Chandler <wchandler@gitlab.com>
Approved-by: Will Chandler <wchandler@gitlab.com>
Approved-by: John Cai <jcai@gitlab.com>
Reviewed-by: Igor Drozdov <idrozdov@gitlab.com>
Reviewed-by: John Cai <jcai@gitlab.com>
Co-authored-by: Igor Drozdov <idrozdov@gitlab.com>
|
|
'master'
git2go: Remove the `Conflicts` function
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5894
Merged-by: karthik nayak <knayak@gitlab.com>
Approved-by: John Cai <jcai@gitlab.com>
Approved-by: Christian Couder <chriscool@tuxfamily.org>
Reviewed-by: karthik nayak <knayak@gitlab.com>
|
|
This commit:
- Moves SSH to a library
- Creates SigningKey interface
- GPG and SSH keys are implementing this interface
|
|
extractSignature is useful for testing if a commit has been properly
signed. It was used by git2go, but now that we are about to sign commits
manually in the localrepo package, we will want to test it there to.
Prepare for this by extracting the function into a helper in an internal
package.
Also, extractSignature does not support sha256 since the gpg prefix for
sha256 is different. Fix this as well.
Finally, the oid parameter actually never gets used. Let's remove it as
well.
|
|
In the previous commit, we removed the only user of git2go's conflict
functionality. With this we can remove all code in git2go around
conflict which is no longer used.
We move out a stray `Merge` function from
`cmd/gitaly-git2go/conflicts.go` to `cmd/gitaly-git2go/merge.go` as its
still being used.
|
|
|
|
This commit uses x/crypto library instead of its fork in order
to implement signing via SSH
Changelog: changed
|
|
The `repository.GitRepo` interface provides a set of functions that
allow us to locate a repository in our storage. It lives in a separate
package outside of the `internal/git` module in order to avoid a set of
cyclic dependencies. The current location is kind of weird though, as
this interface is inherently tied to our storage details instead of
being a generic Git thing.
Move the definition of the interface into `internal/gitaly/storage` so
that it is defined close to where it is used. This should also be a
relatively safe location as any package that depends on the interface
should implicitly already depend on the storage package given that it
will typically be passed down into any kind of storage locator.
While at it, rename it to `storage.Repository`.
|
|
The feature flag logic is currently hosted inside of
`internal/metadata/featureflag`. And while they do have something to do
with metadata, they really are a standalone concept.
Move the package to `internal/featureflag` to reflect this.
|
|
We're about to release Gitaly v16.0. As we've landed a bunch of
previously announced removals it's thus time to bump our Go module
version from v15 to v16.
|
|
Some of the tests don't need any modification for being run with sha256
support. Let's remove the build flag block for such tests.
|
|
- It uses repo.ReadCommit instead of parsing on its own
- Provides interface for testing other signatures (like SSH)
|
|
This commit fixes manually quoted string interpolation with '%s' and
"%s". Quoting this way doesn't escape special characters such as endline
and makes debugging harder later. We encourage to use %q verb instead.
|
|
The function `IndexError.GrpcError()` returns an error that is wrapped
in the correct gRPC error code. Convert it to return a structured error
instead that has the same error code.
|
|
'master'""
This reverts commit 52c5d3444a671264cda5b5725fb94e626a400a21.
Reintroduce the changes originally merged with MR 4988 that were
subsequently reverted.
|
|
This reverts merge request !4988
|
|
In preparation for converting the `UserCommitFiles` RPC to structured
errors, we need to capture the specific problem that occurred. There are
six error types that we track, and while creating a separate error type
for each of these works fine, it's also verbose and requires significant
boilerplate to convert the error to a proto response.
To mitigate this, create a new `IndexError` type that contains an enum
to specify the type of error. This allows us to cover all six error
types with a single case statement when returning from
`UserCommitFiles`, and centralizes the definition of the potential
errors that can be returned. This is similar to the approach taken with
`updateref.CustomHookError`.
The `Proto()` method will be used in the following commit.
|
|
Currently we may receive one of six distinct error types from `git2go`
when executing the `UserCommitFiles` RPC, one for each specific failure
we check, such as file not found, and a generic `IndexError` used for
invalid paths and problems returned from `libgit2` itself.
In preparation for converting `UserCommitFiles` to return structured
errors, we will convert all defined error types into a single error
struct with an internal enum specifying the error type. This will most
logically be named `IndexError`, but to use that name we must first
rename the existing `IndexError` type. Given that we return the latter
in cases where an undefined problem has occurred in `libgit2`, let's
rename it to `UnknownIndexError`.
|
|
We are looking to expose the fact that a commit was not found at the RPC
level. In order to do this we need to distinguish the error in git2go by
creating a new error type over gob.
|
|
A few weeks ago we have decided that `testing.TB` arguments should be
first, `context.Context` second. This is rather a matter of perssnal
taste instead of correctness, but we should strive for consistency.
Reorder all arguments to match the agreed-upon style.
|
|
|
|
Enforce consistent naming of `testing.TB` variables, which should be
called `tb`, and adapt tests that violate this rule.
|
|
Convert all callers of InitRepo to use CreateRepository.
|
|
With the auxiliary binaries packed into the gitaly binary and deployed
as a single unit, we no longer need to maintain backwards compatibility
between them and Gitaly. This commit drops the now unnecessary major
version suffix from the gitaly-git2go binary which was needed due to the
major version upgrades causing the type paths to change and thus breaking
the Gob protocol between the binaries.
|
|
git: Encapsulate object hash specific information
See merge request gitlab-org/gitaly!4720
|
|
Move the `NewObjectIDFromHex()` function into the `ObjectHash` structure
to make it dependent on the hash function used.
|
|
In order to spawn a command via our command package the caller has to
pass in an `exec.Cmd`. This calling convention is weird and opens up the
window for unexpected behaviour in case the caller passes in a command
that is initialized with state unexpected by the command package.
Refactor the package to instead accept a set of arguments. Like this,
the assembled `exec.Cmd` is fully controlled by the command package.
|
|
We're about to add the ability to test with SHA256 hashes. We assume
none of the tests work with this object format.
With this change we add the build constraint to not run any test when
the tag 'gitaly_test_sha256' is set.
|
|
Gitaly needs to locate auxiliary binaries in various places to pass
them as arguments and call them. Currently, the logic to do so is
spread around the code base where the cfg.BinDir is joined with the
binary name. Soon we'll have to make a distinction between binaries
that are in the BinDir and binaries that are unpacked into a runtime
directory on start up. To support this, this commit centralizes the
binary finding logic to BinaryPath helper added to Gitaly's config.
For now, it simply join BinDir with the binary name as each of the
call sites were doing. In a later commit, it will also help with
locating the unpacked binaries correctly.
|