Commit Graph

184 Commits

Author SHA1 Message Date
Kim "BKC" Carlbäcker 0db994fedc Fix encoding error in Gitaly::Commit::TreeEntry 2018-05-30 17:33:17 +02:00
Grzegorz Bizon b113330fab Merge branch 'zj-workhorse-archive-mandatory' into 'master'
Move git archives downloading to Gitaly

See merge request gitlab-org/gitlab-ce!18990
2018-05-21 07:08:58 +00:00
Sergey Sinev 100c687cbc Fix error when deleting an empty list of refs
Closes #45743
2018-05-18 20:47:46 -07:00
Zeger-Jan van de Weg 18a8eb96b3
Calculating repository checksums executed by Gitaly
OPT_OUT status has been removed, and alternative implementation removed.
Also checks if the repository exists before executing the checksum RPC
to guard against NotFound errors.

Closes gitlab-org/gitaly#1105
2018-05-18 16:07:29 +02:00
Zeger-Jan van de Weg 94b209b32c
Move git archives downloading to Gitaly 2018-05-17 09:31:50 +02:00
Zeger-Jan van de Weg 7fc185ab25
Ref contains oid check done by Gitaly
These two endpoints are in opt-out, and no one noticed. Has been running
on .com for 4 months now and considered stable.

Closes https://gitlab.com/gitlab-org/gitaly/issues/884
2018-05-14 15:55:27 +02:00
Douglas Barbosa Alexandre 17258b37c8
Raise InvalidRepository error for non-valid git repositories 2018-05-07 14:22:16 -03:00
Zeger-Jan van de Weg 713c7fa9a5
Client implementation GetRawChanges
Part of https://gitlab.com/gitlab-org/gitaly/issues/1138
2018-05-07 15:37:49 +02:00
Douwe Maan 9cf4e47341 Merge branch 'security-45689-fix-archive-cache-bug' into 'security-10-7'
Serve archive requests with the correct file in all cases (10.7)

See merge request gitlab/gitlabhq!2376
2018-04-30 15:00:14 -05:00
Zeger-Jan van de Weg ec4423665c
Gitlab::Shell works on shard name, not path
Direct disk access is done through Gitaly now, so the legacy path was
deprecated. This path was used in Gitlab::Shell however. This required
the refactoring in this commit.

Added is the removal of direct path access on the project model, as that
lookup wasn't needed anymore is most cases.

Closes https://gitlab.com/gitlab-org/gitaly/issues/1111
2018-04-25 13:36:22 +02:00
Stan Hu 74e5ec198c Fix failing ./spec/lib/backup/repository_spec.rb by clearing the memoized value 2018-04-14 15:36:36 -07:00
Stan Hu b1f15dfa42 Memoize Git::Repository#has_visible_content?
This is called repeatedly when viewing a merge request, and this should
improve performance significantly by avoiding shelling out to git every time.

This should help https://gitlab.com/gitlab-com/infrastructure/issues/4027.
2018-04-14 14:37:28 -07:00
Rubén Dávila d28b1dfc46 Backport of EE !4989 2018-04-11 22:05:07 -05:00
Douglas Barbosa Alexandre 76cd2d7881
Move checksum calculation to Gitlab::Git::Repository 2018-04-06 13:25:07 -03:00
Stan Hu a18eea8c32 Automatically cleanup stale worktrees and lock files upon a push
git 2.16 will fail badly if there are stale worktrees.

Closes #44115
2018-04-06 08:17:07 -07:00
James Ramsay 07f517d441 Add new repository archive route
Repository archives are always named `<project>-<ref>-<sha>` even if
the ref is a commit. A consequence of always including the sha even
for tags is that packaging a release is more difficult because both
the ref and sha must be known by the packager.

- add `<project>/-/archive/<ref>/<filename>.<format>` route using the
`-` separator to prevent namespace collisions. If the filename is
`<project>-<ref>` or the ref is a sha, the sha will be omitted,
otherwise the default filename will be used.
- deprecate previous archive route `repository/<ref>/archive`
2018-04-06 08:45:17 -04:00
James Ramsay 0b1b9c409d Add option to suppress archive commit sha
Repository archives are always named `<project>-<ref>-<sha>` even if
the ref is a commit. A consequence of always including the sha even
for tags is that packaging a release is more difficult because both
the ref and sha must be known by the packager.

- add append_sha option (defaults true) to provide a method for
toggling this feature.

Support added to GitLab Workhorse by gitlab-org/gitlab-workhorse!232
2018-04-04 16:56:18 -04:00
Jacob Vosmaer (GitLab) b942462788 Remove support for absolute dirs from Git::Env 2018-03-30 09:19:46 +00:00
Douwe Maan 39c911eaaa Fix listing commit branch/tags that contain special characters 2018-03-27 18:20:08 +02:00
Zeger-Jan van de Weg 77f0906e4c
Change Gitlab::Shell#add_namespace to #create_namespace
Prior to this change, this method was called add_namespace, which broke
the CRUD convention and made it harder to grep for what I was looking
for. Given the change was a find and replace kind of fix, this was
changed without opening an issue and on another feature branch.

If more dynamic calls are made to add_namespace, these could've been
missed which might lead to incorrect bahaviour. However, going through
the commit log it seems thats not the case.
2018-03-14 09:56:22 +01:00
Ahmad Sherif cd770946c4 Add support for :all option to {count,find}_commits 2018-03-02 14:55:20 +01:00
Sean McGivern 52e133d176 Merge branch 'zj-licensee-key' into 'master'
Client implementation for Licensee#key

See merge request gitlab-org/gitlab-ce!17449
2018-03-01 17:10:39 +00:00
Douwe Maan de454de9b1 Merge branch '42434-allow-commits-endpoint-to-work-over-all-commits' into 'master'
Resolve "Allow API method /projects/:id/repository/commits  to work over all commits"

Closes #42434

See merge request gitlab-org/gitlab-ce!17182
2018-03-01 15:54:43 +00:00
Zeger-Jan van de Weg 34fbade4ae
Client implementation for Licensee#key
Part of the migration as tracked in: gitlab-org/gitaly#1026
2018-03-01 16:41:08 +01:00
Tiago Botelho cd9daf644e Add specs 2018-03-01 14:38:35 +00:00
Zeger-Jan van de Weg c12b18c545
Encode revision for gitattributes ref
A field didn't call the needed encoding helper, thus some UTF-8 encoding
couldn't be encoded to ASCII. Using the helper method this was fixed.

Tests are now run against Gitaly and Rugged too, to ensure both remain
working correctly.

Fixes gitlab-org/gitaly#1032, gitlab-org/gitlab-ce#43278
2018-03-01 09:18:26 +01:00
Sean McGivern e351f67874 Suppress whitespace warnings in squash error messages
These are obscuring the real error, which is confusing for everyone.
2018-02-26 09:08:17 +00:00
Grzegorz Bizon eb421c88ee Merge branch 'fix-squash-with-renamed-files' into 'master'
Fix squash with renamed files

Closes gitlab-ee#4975

See merge request gitlab-org/gitlab-ce!17216
2018-02-22 11:35:34 +00:00
Douwe Maan e503efa320 Merge branch 'zj-branch-contains-git-message' into 'master'
Allow branchnames to be named the same as the commit it points to

See merge request gitlab-org/gitlab-ce!17231
2018-02-22 11:34:03 +00:00
Zeger-Jan van de Weg e70fe78281
Handle branch and tag names which are commit ids
Adds a test where a branch name is also a valid commit id. Git, the
binary should create an error message which is difficult to parse and
leading to errors later, as seen in: gitlab-org/gitlab-ce#43222

To catch these cases in the future,
gitlab-test@1942eed5cc108b19c7405106e81fa96125d0be22 was created. Which
a branch name matching the commit
2018-02-21 19:08:26 +01:00
Ken ed0a029d53 26039 - update github-linguist to 5.3.3 version
26039 - add merge request id


26039 change due to lingust source file updates
2018-02-21 03:29:04 +10:30
Sean McGivern 01f5035bfe Fix squash with renamed files
We need to ignore the names for renamed files when configuring with sparse
checkout.
2018-02-19 15:11:10 +00:00
Stan Hu 8d32dfef9b Fix squash rebase not working when diff contained encoded data
When the applied diff contains UTF-8 or some other encoded data, the diff
returned back from the git process may be in ASCII-8BIT format. Writing this
data to stdin may fail if the data because stdin expects this data to be in
UTF-8. By switching the output to binmode, we ensure that the diff will
always be written as-is.

Closes gitlab-org/gitlab-ee#4960
2018-02-18 21:48:49 -08:00
Zeger-Jan van de Weg 73e78c4e15
Don't use rugged in Repository#refs_hash
The refs hash is used to determine what branches and tags have a commit
as head in the network graph. The previous implementation depended on
Rugged#references. The problem with this implementation was that it
depended on rugged, but also that it iterated over all references and
thus loading more data than needed if for example the project uses CI/CD
environments, Pipelines, or Merge Requests.

Given only refs are checked the network cares about the GraphHelper#refs
method has no need to reject those, simplifying the method.

Closes gitlab-org/gitaly#880
2018-02-07 15:07:03 +01:00
Rémy Coutable f5990e444a Merge branch 'gitaly-user-squash' into 'master'
Incorporate OperationService.UserSquash Gitaly RPC

Closes gitaly#991

See merge request gitlab-org/gitlab-ce!16899
2018-02-05 10:32:20 +00:00
Grzegorz Bizon 5aea8dc1a6 Merge branch 'fix/remove-duplicated-logic-between-model-and-lib-in-find-branch' into 'master'
Remove repo reloading logic from Repository#find_branch

Closes #42609

See merge request gitlab-org/gitlab-ce!16815
2018-02-03 21:47:28 +00:00
Alejandro Rodríguez e60bf2f256 Incorporate OperationService.UserSquash Gitaly RPC 2018-02-02 19:02:40 -03:00
Ahmad Sherif 05f17e4d72 Remove repo reloading logic from Repository#find_branch
Gitlab::Git::Repository#find_branch has a similar logic.

Fixes #42609
2018-02-02 22:24:54 +01:00
Alejandro Rodríguez 658749ddd3 Fix an issue where sparse checkout wasn't configured correctly
This was affecting the performance of `Gitlab::Git::Repository#squash`.
2018-02-01 17:07:40 -03:00
Robert Speicher 2793e3e1cc Merge branch 'gitaly-970-repo-write-config' into 'master'
Migrate Gitlab::Git::Repository#write_config to Gitaly

Closes gitaly#970

See merge request gitlab-org/gitlab-ce!16730
2018-02-01 19:46:32 +00:00
Rémy Coutable 76b9f1a4c5 Merge branch '42497-rubocop-style-regexpliteral' into 'master'
Enable Style/RegexpLiteral cop

Closes #42497

See merge request gitlab-org/gitlab-ce!16752
2018-02-01 09:11:09 +00:00
Takuya Noguchi 2b6307f6ad Enable RuboCop Style/RegexpLiteral 2018-02-01 02:06:07 +09:00
Kim "BKC" Carlbäcker 28bbb4cb47 Migrate Gitlab::Git::Repository#write_config to Gitaly
- Add tests for Repository#write_config
2018-01-31 15:02:31 +01:00
Jacob Vosmaer afe665d9c0 Remove Rugged::Walk implementation of #log 2018-01-31 11:56:36 +01:00
Ahmad Sherif 1ebb781f6a Migrate Git::Repository#delete_refs to Gitaly
Closes gitaly#967
2018-01-30 23:48:51 +01:00
Jacob Vosmaer (GitLab) 5c2fe2d3d7 Decouple more of Repository from Rugged 2018-01-30 16:21:55 +00:00
Jacob Vosmaer (GitLab) e407c2d18f Don't allow Repository#log with limit zero 2018-01-29 15:27:46 +00:00
Ahmad Sherif 2290b438f4 Fix rubocop offenses introduced in !16623 2018-01-25 20:44:16 +01:00
Robert Speicher af95ba2fb4 Merge branch 'feature/migrate-repo-restorer-to-gitaly' into 'master'
Migrate restoring repo from bundle to Gitaly

Closes gitaly#946

See merge request gitlab-org/gitlab-ce!16623
2018-01-25 19:03:51 +00:00
Jacob Vosmaer (GitLab) 7363aa0b9d Revert "Merge branch 'remove-rugged-walk' into 'master'"
This reverts merge request !16525
2018-01-25 11:03:29 +01:00