Stan Hu
2ce7559d70
Fix repository cache invalidation issue when project is recreated with an empty repo
...
To reproduce:
1. Create a project with some content
2. Rename the project
3. Create a new project with the same name.
4. Boom - 404.
After step 2, the branch and tag counts were not being cleared. This would
cause `repository.has_visible_content?` to erroneously return `true`
for the newly-created project.
Closes #13384
2016-04-13 00:04:17 -07:00
Jeroen Bobbeldijk
f36655dc8b
Dont return null
2016-04-11 18:14:01 +02:00
Jeroen Bobbeldijk
27d2b35535
Add changelog, change code to guard clause
2016-04-11 18:11:49 +02:00
Jeroen Bobbeldijk
08c3936b83
Check head unborn in rugged
2016-04-11 15:10:14 +02:00
Stan Hu
27b9f64efb
Expire caches after project creation to ensure a consistent state
...
Closes #14961
2016-04-07 00:29:01 -07:00
Douglas Barbosa Alexandre
f2005fa566
Flush repository cache before import project data
...
GitHub Pull Requests importer handle with the repository while
importing data, we need to make sure that the cached values are valid.
2016-04-04 19:35:39 -03:00
Douwe Maan
ba7fcc9866
Merge branch 'update_repository_from_ee' into 'master'
...
Migrate Repository#local_branches from gitlab-ee.
REF: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/249
This will help us to avoid posible merge conflicts when merging
gitlab-ce to gitlab-ee
See merge request !3496
2016-04-04 14:25:15 +00:00
Stan Hu
b43e059748
Don't fetch any tags from a forked repo
...
Closes #13957
2016-04-02 00:45:07 -07:00
Rubén Dávila
e6b5716785
Migrate Repository#local_branches from gitlab-ee.
...
This will help us to avoid posible merge conflicts when merging
gitlab-ce to gitlab-ee
2016-04-01 14:21:08 -05:00
Stan Hu
2e328c1ea7
Expire the exists cache before deletion to ensure project dir actually exists
...
Closes #14659
2016-03-27 08:52:44 -07:00
Stan Hu
c1834664a7
Merge branch 'handle-avatar-in-empty-repo' into 'master'
...
Don't attempt to look up an avatar in repo if repo directory does not exist
Relates to https://sentry.gitlap.com/gitlab/gitlabcom/issues/3507/
Closes #14580
See merge request !3390
2016-03-27 00:21:57 +00:00
Dmitriy Zaporozhets
179bae9968
rescue Rugged::ReferenceError in Repository#gitlab_ci_yml method
...
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com >
2016-03-25 17:54:57 +01:00
Stan Hu
506878970b
Don't attempt to look up an avatar in repo if repo directory does not exist
...
Closes #14580
2016-03-25 06:30:51 -07:00
Dmitriy Zaporozhets
ed8e1faa4c
Make sure Repository#gitlab_ci_yml is safe to use even when repository is missing
...
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com >
2016-03-25 14:19:20 +01:00
Dmitriy Zaporozhets
b105b84e3a
Use head tree (cached) for file search. Also add some tests
...
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com >
2016-03-24 15:38:16 +01:00
Dmitriy Zaporozhets
3b1543cd15
Detect build setup state based on gitlab_ci.yml presense
...
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com >
2016-03-24 15:17:13 +01:00
Yorick Peterse
68a4c98f50
Cache output of Repository#exists?
...
This caches the output of Repository#exists? in Redis while making sure
it's flushed properly when creating new repositories, deleting them,
etc.
For the ProjectWiki tests to work I had to make ProjectWiki#create_repo!
public as testing private methods in RSpec is a bit of a pain.
2016-03-19 21:54:08 +01:00
Yorick Peterse
3d7feeede3
Don't rebuild diverging commit count caches
...
When calling Repository#build_cache we _don't_ want to build the
diverging commit count cache as doing so can be _very_ slow for
repositories with lots of branches. Because these caches are built
whenever needed (= when actually viewing the list of branches in the web
UI) we can safely remove this code from
Repository#build_cache.
2016-03-17 21:43:38 +01:00
Yorick Peterse
81d191ede9
Removed Repository#rebuild_cache
...
This method is not used or tested anywhere.
2016-03-17 21:43:38 +01:00
Yorick Peterse
cd05d3f78d
Cache project avatars stored in Git
...
The avatar logic has been moved from Project to Repository as this makes
caching easier. The logic itself in turn has been changed so that the
logo file names are cached in Redis. This cache is flushed upon pushing
a commit but _only_ if:
1. The commit was pushed to the default branch
2. The commit actually changes any of the logo files
If no branch or commit is given the cache is flushed anyway, this
ensures that calling Repository#expire_cache without any arguments still
flushes the avatar cache (e.g. this is used when removing a project).
Fixes gitlab-org/gitlab-ce#14363
2016-03-17 18:51:54 +01:00
Hiroyuki Sato
f0b052e168
Fix wiki search results point to raw source
2016-03-17 08:58:52 +09:00
Yorick Peterse
590e1b4b21
Call after_create_branch in Repository#add_branch
...
This ensures the right caches are flushed when adding a branch via the
UI, instead of only flushing this one random cache.
2016-03-08 18:19:40 +01:00
Yorick Peterse
4ec035b488
Call the right hooks in Repository#add_tag
...
This ensures Repository#add_tag calls Repository#before_push_tag instead
of just 1 random cache expiration method.
2016-03-08 18:19:40 +01:00
Yorick Peterse
177025b5dd
Call the right hooks when removing branches
...
This ensures that Repository#rm_branch calls
before_remove_branch/after_remove_branch instead of just 1 random cache
expiration method.
2016-03-08 18:19:40 +01:00
Yorick Peterse
cb5a5ba095
Cache & flush tag/branch counts
...
The methods used for this are Repository#tag_count and
Repository#branch_count which cache their output in Redis as well as
memoizing it in an instance variable. Both methods have a corresponding
methods/hooks to flush the caches at the right time.
2016-03-08 18:19:40 +01:00
tiagonbotelho and Yorick Peterse
c2c5572e22
adds swp and swo to gitignore and improves migration for project main_language
2016-03-07 21:59:39 +01:00
tiagonbotelho and Yorick Peterse
dc31aff3da
removes unused methods that I forgot
2016-03-07 21:59:39 +01:00
tiagonbotelho and Yorick Peterse
d9e646a796
moves method to repository model
2016-03-07 21:59:39 +01:00
Rubén Dávila
d9e0191592
Add some specs for Repository#revert.
2016-03-01 19:16:27 -05:00
Rubén Dávila
0c116d8ed6
Check for conflicts before creating target branch.
2016-03-01 19:16:27 -05:00
Yorick Peterse
3b520efdc7
Moved exists condition in Repository#before_delete
...
This is only needed when calling the "expire_cache" method as the other
expiration methods don't depend on Git data.
2016-02-25 12:55:37 +01:00
Yorick Peterse
a39f7b30c5
Move Repository#expire_all_caches to before_delete
2016-02-23 12:27:34 +01:00
Yorick Peterse
ff28a7cc36
Moved cache expiration code to Repository hooks
...
This keeps all the cache expiration code in a single file/class instead
of spreading it all across the codebase.
2016-02-23 12:02:59 +01:00
Yorick Peterse
e0cb3212ed
Flush emptiness caches whenever needed
...
This ensures that the emptiness cache (used for Repository#empty? and
Repository#has_visible_content?) is flushed after comitting changes
(using the web editor, API or Git) for new repositories. Once a
repository is no longer empty there's no need to explicitly flush the
cache for Repository#empty?. The cache for
Repository#has_visible_content? in turn is already flushed whenever
needed.
Fixes gitlab-org/gitlab-ce#13387
2016-02-20 20:17:50 +01:00
Rubén Dávila and Robert Speicher
169070ba4b
Some updates from last code review.
2016-02-19 13:14:54 -05:00
Rubén Dávila and Robert Speicher
d958d027dc
Make #commit_with_hooks return the new obj id plus some other fixes.
2016-02-19 13:14:54 -05:00
Rubén Dávila and Robert Speicher
a07021fa8e
Make more robust the test to see if a commit has been previously reverted.
2016-02-19 13:14:54 -05:00
Rubén Dávila and Robert Speicher
b8295fc323
Fix build and add specs
2016-02-19 13:14:53 -05:00
Rubén Dávila and Robert Speicher
2ea5b37f2e
Some fixes and refactors for code related to forks.
2016-02-19 13:14:53 -05:00
Rubén Dávila and Robert Speicher
11345866d8
Don't make Repository#revert aware of MRs.
2016-02-19 13:14:52 -05:00
Rubén Dávila and Robert Speicher
328b52d58a
Some updates after last code review.
2016-02-19 13:14:52 -05:00
Rubén Dávila and Robert Speicher
38e708f0ce
Add link to fork if user can't revert MR.
2016-02-19 13:14:52 -05:00
Rubén Dávila and Robert Speicher
e22cdb40ec
Big refactor for #revert_commit.
...
* Now checking if a commit is already reverted or there is a conflict is
much more faster.
* No longer need to create a new branch.
2016-02-19 13:14:51 -05:00
Rubén Dávila and Robert Speicher
ef591b87d1
Fix commit message plus other little fix.
2016-02-19 13:14:51 -05:00
Rubén Dávila and Robert Speicher
b0693318c3
Show list of branches plus some fixes.
2016-02-19 13:14:51 -05:00
Rubén Dávila and Robert Speicher
6b0e478353
Some fixes required for conflicts on revert.
2016-02-19 13:14:51 -05:00
Rubén Dávila and Robert Speicher
91e6e32d13
Make it work for merge commits.
2016-02-19 13:14:51 -05:00
Rubén Dávila and Robert Speicher
b36319a17c
Make MRs with revert commit work.
2016-02-19 13:14:50 -05:00
Rubén Dávila and Robert Speicher
8061399368
Add RevertService class with basic logic to revert commit
2016-02-19 13:14:50 -05:00
Rubén Dávila and Robert Speicher
b6fe51b901
Some updates from last code review.
2016-02-19 13:14:50 -05:00