Commit Graph

182 Commits

Author SHA1 Message Date
Tiago Botelho 084a8b6101
Adds tracing messages for slow git pushes
Whenever a git push takes more than 50 seconds the user
will receive a trace from each check performed along with
their timings
2018-10-25 10:10:45 +01:00
gfyoung c858f70d07 Enable frozen string for lib/gitlab/*.rb 2018-10-22 07:00:50 +00:00
Semyon Pupkov 67cdb1d1be Fix SpaceInsidePercentLiteralDelimiters cop 2018-09-20 21:54:14 +05:00
Ash McKenzie 90f67306ab
Remove Gitlab::GitAccess#authed_via_jwt?
Previously overridden in EE but no longer required.
2018-09-08 14:43:24 +10:00
Ash McKenzie 4fac214b5d
Update /api/v4/allowed
- Use proper HTTP codes for /api/v4/allowed response
- CustomAction support
2018-09-06 18:39:24 +10:00
Ash McKenzie c27a5d2344
GitAccess#check custom action support
- if #check_custom_action!(cmd) returns something, return from #check()
- now returns :Gitlab::GitAccessResult::Success.new instead of true
2018-09-06 18:38:19 +10:00
Ash McKenzie b2103cb431
Allow auth via JWT (always false in CE) 2018-08-14 15:56:44 +10:00
Rubén Dávila b98bff13de Backport some changes from EE 2018-07-09 12:32:37 -05:00
Bob Van Landuyt e0768a9bcb Allow triggered builds git access
Allow builds that have been triggered by a user before terms were
enforced access to git. That way the builds can complete as usual.
2018-05-11 15:20:11 +02:00
Bob Van Landuyt f7f13f9db0 Block access to API & git when terms are enforced
When terms are enforced, but the user has not accepted the terms
access to the API & git is rejected with a message directing the user
to the web app to accept the terms.
2018-05-10 17:02:27 +02:00
Kamil Trzciński 72220a99d1 Support Deploy Tokens properly without hacking abilities 2018-04-06 21:20:16 -05:00
Mayra Cabrera 370fc05da7 Implement 'read_repo' for DeployTokens
This will allow to download a repo using the token from the DeployToken
2018-04-06 21:20:16 -05: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
Tomasz Maczukin edcba1aa27
Allow HTTP(s) when git request is made by GitLab CI 2018-04-05 12:35:12 +02:00
Sean McGivern 869b7b31cf Merge branch 'dm-deploy-keys-default-user' into 'master'
Ensure hooks run when a deploy key without a user pushes

Closes #44317

See merge request gitlab-org/gitlab-ce!18057
2018-03-29 09:30:10 +00:00
Douwe Maan 7bca902a23 Fall back on ghost user when deploy key user is not set 2018-03-28 18:54:15 +02:00
Bob Van Landuyt ce69419a60 Remove permanent redirects
Removes permanent redirects, this means that redirects will only be
possible as long as the old route isn't taken by a new project/group.
2018-03-28 14:12:08 +02:00
Michael Kozono 4be20ba923 Respond 404 when repo does not exist 2018-02-24 16:22:29 -08:00
Jacob Vosmaer (GitLab) ea18e1bf28 Fix repo existence check in GitAccessWiki 2018-02-22 00:20:30 +00:00
James Edwards-Jones c88fe70f90 Only check LFS integrity for first branch in push 2018-02-15 01:57:55 +00:00
Tiago Botelho 8b4280cb25 Check ability ability before proceeding with project specific checks 2018-02-06 18:38:10 +00:00
Tiago Botelho 1e56b3f476 Moves project creationg to git access check for git push 2018-02-06 16:52:29 +00:00
Tiago Botelho 839829a778 Adds documentation for the feature 2018-02-06 13:35:35 +00:00
Tiago Botelho dc229c076c Abstracts ProjectMoved and ProjectCreated into a BaseProject 2018-02-06 13:35:35 +00:00
Tiago Botelho e42a548f1d Move new project on push logic to a service 2018-02-06 13:35:35 +00:00
Tiago Botelho bc78ae6985 Add specs 2018-02-06 13:35:35 +00:00
Tiago Botelho 32b2ff2601 Adds remote messsage when project is created in a push over SSH or HTTP 2018-02-06 13:35:35 +00:00
Tiago Botelho 35882e681b Adds option to push over SSH to create a new project 2018-02-06 13:35:35 +00:00
Tiago Botelho 921d2afc69 Adds option to push over HTTP to create a new project 2018-02-06 13:35:35 +00:00
Mayra Cabrera 562fb460b8 Allow git pull/push on project redirects 2017-12-08 17:42:43 +00:00
James Lopez 7af56500a1 refactor code to match EE changes 2017-12-07 17:13:40 +01:00
Alejandro Rodríguez a64601b929 Move all rugged operation for ff_merge inside Gitlab::Git
We also delete some unused code related to the aforementioned feature.
2017-10-24 14:31:52 -03:00
Toon Claes d13669716a Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.

Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.

Closes gitlab-org/gitlab-ce#37534.
2017-10-06 22:37:40 +02:00
Gabriel Mazetto 38607b48b6
[Backported from EE] Readonly flag for Projects
This is used in EE for the storage migration, and we want to use this
in CE as well to be able to migrate projects to hashed_storage.
2017-09-28 13:20:11 +01:00
Nick Thomas b84ca08e35 Address review comments 2017-08-30 20:50:44 +01:00
Nick Thomas b0f982fbdf Add settings for minimum key strength and allowed key type
This is an amalgamation of:

* Cory Hinshaw: Initial implementation !5552
* Rémy Coutable: Updates !9350
* Nick Thomas: Resolve conflicts and add ED25519 support !13712
2017-08-30 20:50:44 +01:00
Robert Speicher 5b37f21bf2 Reduce duplication in GitAccess spec around error messages
- Adds a new `ProjectMovedError` class to encapsulate that error
  condition. Inherits from `NotFoundError` so existing rescues should
  continue to work.
- Separating that condition out of `NotFoundError` allowed us to
  simplify the `raise_not_found` helper and avoid repeating the literal
  string.
- Spec makes use of `ERROR_MESSAGES` hash to avoid repeating literal
  error message strings.
2017-08-18 15:16:54 -04:00
Michael Kozono af784cc6e2 Add “Project moved” error to Git-over-SSH 2017-06-16 14:14:19 -07:00
Michael Kozono d7eee7332b Extract and memoize `user_access`
Because it is sometimes never used.
2017-06-05 05:32:26 -07:00
Michael Kozono 0e3cfc75a3 Remove GitAccessStatus (no longer needed) 2017-06-05 05:32:26 -07:00
Michael Kozono 0a0f66c816 Refactor to remove a special case 2017-06-05 05:32:26 -07:00
Michael Kozono 7d469cf1c1 Fix would-be regression
57e3e942de

I changed it to a separate condition rather than depending on the order of the case-when statements to prevent this mistake again.
2017-06-05 05:32:26 -07:00
Michael Kozono e8972c1190 Clarify error messages
And refactor to self-document a little better.
2017-06-05 05:32:26 -07:00
Michael Kozono 23d37382da Refactor to let GitAccess errors bubble up
No external behavior change.

This allows `GitHttpController` to set the HTTP status based on the type of error. Alternatively, we could have added an attribute to GitAccessStatus, but this pattern seemed appropriate.
2017-06-05 05:32:26 -07:00
Michael Kozono bad08fbea2 Move CI access logic into GitAccess 2017-06-05 05:32:26 -07:00
Michael Kozono a738a446f4 Check disabled commands in GitAccess instead 2017-06-05 05:32:26 -07:00
Michael Kozono ff8a053d5d Fix Git over HTTP spec
* The spec has 7 failures at this point
* Specify rendered error messages
* Render the GitAccess message rather than “Access denied”
* Render the Not Found message provided by GitAccess, instead of a custom one
* Expect GitAccess to check the config for whether Git-over-HTTP pull or push is disabled, rather than doing it in the controller
* Add more thorough testing for authentication
* Dried up a lot of tests
* Fixed some broken tests
2017-06-05 05:32:26 -07:00
Rémy Coutable 3de11e1a00 Don't pass `env` anymore to GitAccess, ChangeAccess, and ForcePush
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-10 16:10:18 +02:00
Adam Niedzielski 47270e1cfd Backport changes from gitlab-org/gitlab-ee!1406 2017-03-13 12:31:27 +01:00
Douwe Maan b7d8df503c Enable Style/MutableConstant 2017-02-23 09:31:56 -06:00
Lin Jen-Shin c1d11bf57c Rubocop prefers to indent this way 2016-12-20 23:30:01 +08:00
Lin Jen-Shin 884f57c910 Use consistent names and move checks to the method,
and move those checks to be private. Feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_20285012

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_20285279
2016-12-20 21:19:07 +08:00
Lin Jen-Shin 0f0738e788 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (538 commits)
  Reject blank environment vcariables in Gitlab::Git::RevList
  Add online terminal documentation
  Add changelog entry
  Add terminal UI and controller actions
  Fix specs
  Even out padding on plus button in breadcrumb menu
  Update font size of detail page header to 14px
  Update CHANGELOG.md for 8.13.10
  Update CHANGELOG.md for 8.14.5
  Fix Route#rename_children behavior
  Remove inline-block styling from status
  Add terminals to the Kubernetes deployment service
  Add a ReactiveCaching concern for use in the KubernetesService
  Add xterm.js 2.1.0 and a wrapper class to the asset pipeline
  Remove unnecessary hidden svg elements for icons.
  Fix consistent typo in environment.js
  Use a block to insert extra check for authenticate_build!
  Align milestone column header with count number
  Add Wiki import to BB importer
  Make CI badge hitboxes better match container
  ...
2016-12-20 20:54:40 +08:00
Timothy Andrew f82d549d26 Accept environment variables from the `pre-receive` script.
1. Starting version 2.11, git changed the way the pre-receive flow works.

  - Previously, the new potential objects would be added to the main repo. If the
    pre-receive passes, the new objects stay in the repo but are linked up. If
    the pre-receive fails, the new objects stay orphaned in the repo, and are
    cleaned up during the next `git gc`.

  - In 2.11, the new potential objects are added to a temporary "alternate object
    directory", that git creates for this purpose. If the pre-receive passes, the
    objects from the alternate object directory are migrated to the main repo. If
    the pre-receive fails the alternate object directory is simply deleted.

2. In our workflow, the pre-recieve script (in `gitlab-shell) calls the
   `/allowed` endpoint, which calls out directly to git to perform
   various checks. These direct calls to git do _not_ have the necessary
   environment variables set which allow access to the "alternate object
   directory" (explained above). Therefore these calls to git are not able to
   access any of the new potential objects to be added during this push.

3. We fix this by accepting the relevant environment variables
   (GIT_ALTERNATE_OBJECT_DIRECTORIES, GIT_OBJECT_DIRECTORY) on the
   `/allowed` endpoint, and then include these environment variables while
   calling out to git.

4. This commit includes (whitelisted) these environment variables while making
   the "force push" check. A `Gitlab::Git::RevList` module is extracted to
   prevent `ForcePush` from being littered with these checks.
2016-12-16 23:32:25 +05:30
Lin Jen-Shin 8ac50d78eb Check project existence for push too, and
we don't have to check for deploy key for downloading
because deploy key could certainly download when it
could already read the project.

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_19578626
2016-12-10 02:04:36 +08:00
Lin Jen-Shin 57e3e942de Don't pass the actor for deploy key, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_19579483
2016-12-10 01:45:13 +08:00
Lin Jen-Shin 46d7c1d2b3 Prefer guest_can_download_code? and fix typo 2016-12-06 21:10:27 +08:00
Lin Jen-Shin 1b150576d9 Prefer guest_can_downlod_code? 2016-12-06 21:09:23 +08:00
Lin Jen-Shin d6287ab230 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (488 commits)
  Merge branch 'issue_25064' into 'security'
  It's secret variables, not secure
  Fix dead links, add example of debug trace output, simplify titles
  Authorize users into imported GitLab project
  Document button secondary states. Update icons and color section
  Remove unused votes.scss
  Remove unused errors css
  Fixed MR widget content wrapping for XS viewports
  NIGNX -> Nginx
  Use pry-byebug instead byebug
  Fixed influence from other specs.
  Accept `issue new` as command to create an issue
  Update paranoia from 2.1.4 to 2.2.0.
  Use the pagination helper in the API
  Added changelog for #25221
  Fixed top margin for Builds page status header information
  Satisfied eslint
  Fix compatibility with Internet Explorer 11 for merge requests
  change the date label to match the date used
  fix gfm doc typo about two spaces for next line transfer
  ...
2016-12-06 20:53:07 +08:00
Douglas Barbosa Alexandre d6b9b21e6d Allow access to the wiki with git when repository feature disabled 2016-11-30 16:02:24 -02:00
Lin Jen-Shin 8dbea58249 Check download privilege more specifically and
add another error message for the new error.
2016-11-18 17:28:05 +08:00
Lin Jen-Shin e72e2f9ba0 Still grant :download_code if guest could do that
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_18518792
2016-11-18 04:23:55 +08:00
Lin Jen-Shin 0c532dbb24 Check if the key could really download, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_18518792
2016-11-18 04:08:24 +08:00
Lin Jen-Shin 8c1a01e05f We never check user privilege if it's a deploy key 2016-11-18 03:48:23 +08:00
Lin Jen-Shin a9765fb47f Introduce has_access_to? so that we could reuse it
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_18439108
2016-11-16 20:31:23 +08:00
Lin Jen-Shin 7214781230 Also need to check against push rules:
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7383#note_18440615
2016-11-16 19:48:54 +08:00
Lin Jen-Shin 5da9bfa453 Fix test for GitAccessWiki, it's overriding change_access_check 2016-11-11 22:26:05 +08:00
Lin Jen-Shin 71ae01fefe Add more tests and fix write to project check 2016-11-11 21:44:33 +08:00
Lin Jen-Shin 38fbcb99db So deploy key might not have a corresponding user 2016-11-11 21:24:21 +08:00
Lin Jen-Shin 05cc87052a Improve write access check for deploy key 2016-11-11 20:40:28 +08:00
Lin Jen-Shin 42e252da42 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (3852 commits)
  Grapify token API
  Fix cache for commit status in commits list to respect branches
  Grapify milestones API
  Grapify runners API
  Improve EeCompatCheck, cache EE repo and keep artifacts for the ee_compat_check task
  Use 'Forking in progress' title when appropriate
  Fix CHANGELOG after 8.14.0-rc1 tag
  Update CHANGELOG.md for 8.14.0-rc1
  Fix YAML syntax on CHANGELOG entry
  Remove redundant rescue from repository keep_around
  Remove redundant space from repository model code
  Remove order-dependent expectation
  Minor CHANGELOG.md cleanups
  Add a link to Git cheatsheet PDF in docs readme
  Grapify the session API
  Add 8.13.5, 8.12.9, and 8.11.11 CHANGELOG
  Merge branch 'unauthenticated-container-registry-access' into 'security'
  Merge branch '23403-fix-events-for-private-project-features' into 'security'
  Merge branch 'fix-unathorized-cloning' into 'security'
  Merge branch 'markdown-xss-fix-option-2.1' into 'security'
  ...
2016-11-10 15:16:33 +00:00
Douwe Maan b0bf92140f
Merge branch 'fix-unathorized-cloning' into 'security'
Ensure external users are not able to clone disabled repositories.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23788

See merge request !2017

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:27:17 +01:00
Kamil Trzcinski e941365f3b Rename capabilities to authentication_abilities 2016-09-16 11:12:21 +02:00
Kamil Trzcinski 9d1ccd2ad3 Fix existing authorization specs 2016-09-15 13:49:11 +02:00
Kamil Trzcinski 6b381f3fdf Use `build_read_container_image` and use `build_download_code` 2016-09-15 10:34:53 +02:00
Kamil Trzcinski 571226f166 Make result to return project and capabilities granted 2016-09-13 15:27:05 +02:00
Kamil Trzcinski 505dc808b3 Use a permissions of user to access all dependent projects from CI jobs (this also includes a container images, and in future LFS files) 2016-09-13 13:30:26 +02:00
Ali Ibrahim 2811a213a6 added spacing 2016-08-19 16:21:14 -04:00
Ali Ibrahim 2b73aaa15a Allow to add deploy keys with write-access 2016-08-17 11:11:08 -04:00
Scott Le 6109daf480 api for generating new merge request
DRY code + fix rubocop

Add more test cases

Append to changelog

DRY changes list

find_url service for merge_requests

use GET for getting merge request links

remove files

rename to get_url_service

reduce loop

add test case for cross project

refactor tiny thing

update changelog
2016-08-11 23:37:00 +07:00
Rémy Coutable af019d2fa7 Merge branch 'fix-gitaccess-scope' into 'master'
Fixing scope issue in GitAccess.

This MR fixes a scoping issue around the GitAccessStatus.new call - it needs to be scoped to the Gitlab otherwise it can end up being confused with the GitAccessStatus class in gitlab-shell, which has a 3-element constructor.

Although not strictly necessary for community GitLab, it is more correct, and fixes an issue we (Perforce) found due to our engine overrides.

This change should have any affect on community GitLab.

See merge request !5483
2016-08-11 11:37:01 +00:00
Jacob Vosmaer b8f754dd0a Stop 'git push' over HTTP early
Before this change we always let users push Git data over HTTP before
deciding whether to accept to push. This was different from pushing
over SSH where we terminate a 'git push' early if we already know the
user is not allowed to push.

This change let Git over HTTP follow the same behavior as Git over
SSH. We also distinguish between HTTP 404 and 403 responses when
denying Git requests, depending on whether the user is allowed to know
the project exists.
2016-08-03 14:54:12 +02:00
Elliot Wiltshire 2e6085d8af Fixing scope issue in GitAccess. 2016-07-25 14:46:40 -07:00
Kamil Trzcinski 2532ec9edc Allow to pull code with deploy key from public projects 2016-07-19 12:23:41 +02:00
Rémy Coutable 2cf7f09b1e
Revert "Revert "Merge branch '18193-developers-can-merge' into 'master' ""
This reverts commit 530f5158e2.

See !4892.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-18 10:16:56 +02:00
Robert Speicher 530f5158e2 Revert "Merge branch '18193-developers-can-merge' into 'master' "
This reverts commit 9ca633eb4c, reversing
changes made to fb229bbf79.
2016-07-13 13:57:30 -05:00
Timothy Andrew ea9e8f4609 Move all "checks" under `GitLab::Checks`.
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4892#note_12892160
- This is more consistent.
2016-07-13 13:24:56 +05:30
Timothy Andrew 4d00ed21eb Appease rubocop. 2016-07-13 13:24:56 +05:30
Timothy Andrew 60245bbe22 Refactor `Gitlab::GitAccess`
1. Don't use case statements for dispatch anymore. This leads to a lot
   of duplication, and makes the logic harder to follow.

2. Remove duplicated logic.

    - For example, the `can_push_to_branch?` exists, but we also have a
      different way of checking the same condition within `change_access_check`.

    - This kind of duplication is removed, and the `can_push_to_branch?`
      method is used in both places.

3. Move checks returning true/false to `UserAccess`.

    - All public methods in `GitAccess` now return an instance of
      `GitAccessStatus`. Previously, some methods would return
      true/false as well, which was confusing.

    - It makes sense for these kinds of checks to be at the level of a
      user, so the `UserAccess` class was repurposed for this. The prior
      `UserAccess.allowed?` classmethod is converted into an instance
      method.

    - All external uses of these checks have been migrated to use the
      `UserAccess` class

4. Move the "change_access_check" into a separate class.

    - Create the `GitAccess::ChangeAccessCheck` class to run these
      checks, which are quite substantial.

    - `ChangeAccessCheck` returns an instance of `GitAccessStatus` as
      well.

5. Break out the boolean logic in `ChangeAccessCheck` into `if/else`
   chains - this seems more readable.

6. I can understand that this might look like overkill for !4892, but I
   think this is a good opportunity to clean it up.

    - http://martinfowler.com/bliki/OpportunisticRefactoring.html
2016-07-13 13:24:56 +05:30
Timothy Andrew 495db09653 Enforce "developers can merge" during `pre-receive`.
1. When a merge request is being merged, save the merge commit SHA in
   the `in_progress_merge_commit_sha` database column.

2. The `pre-receive` hook looks for any locked (in progress) merge
   request with `in_progress_merge_commit_sha` matching the `newrev` it
   is passed.

3. If it finds a matching MR, the merge is legitimate.

4. Update `git_access_spec` to test the behaviour we added here. Also
   refactored this spec a bit to make it easier to add more contexts / conditions.
2016-07-13 13:24:56 +05:30
Mathias Vestergaard f0577d8385 Added "developers can merge" setting to protected branches
- Cherry-picked from `mvestergaard:branch-protection-dev-merge`
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4220
2016-07-13 13:24:26 +05:30
Patricio Cano be221a30ac Revert back to not defining a default Git access protocol. 2016-07-05 16:54:22 -05:00
Patricio Cano 29c50c5315 Default Git access protocol to `web` 2016-07-05 16:54:22 -05:00
Patricio Cano d1151f7621 Don't allow empty strings in the `protocol` check. 2016-07-05 16:54:22 -05:00
Patricio Cano 9397ce9137 Correct access control flow for Git HTTP requests. 2016-07-05 16:54:22 -05:00
Patricio Cano ace309d775 Raise an error if no protocol is passed to the GitAccess check. 2016-07-05 16:54:22 -05:00
Patricio Cano 8b14d1d2c2 Rename ENV['PROTOCOL'] to ENV['GL_PROTOCOL'] to conform to what GitLab Shell expects and make the `protocol` param in `GitAccess` mandatory. 2016-07-05 16:54:22 -05:00
Patricio Cano 7735ef86f0 Only allow Git Access on the allowed protocol 2016-07-05 16:54:22 -05:00
Stan Hu 4be77d0b05 Improve multiple branch push performance by memoizing permission checking
If you attempt to push thousands of branches at once, the 60-second timeout
will occur because GitAccess checking does a lot of work to check if the
user has permission to push to a branch. This changes does two things:

1. Instead of making 1 DB query per branch push, use a memoized list of protected branches to check
2. Memoize what permissions the user has to perform on this project

On a test of 10,000 branch pushes, this prevents gitlab-shell from hitting the 60-second
timeout.

Closes #17225
2016-05-09 01:17:14 -07:00
Yorick Peterse 003671207d
Fix passing nil to protected_tag?
Previously this method would directly receive the output of tag_name().
This method could either return a String or nil. In the previous setup
this would somehow magically work but because Rugged::TagCollection#[]
doesn't accept nil values it started to fail.

To work around this the elsif in change_access_check() assigns the
result of tag_name() to a local and then _only_ calls protected_tag?()
if the tag name is not nil. The extra parenthesis are put in place to
ensure that things are parsed correctly, without these the code would be
parsed as follows:

    elsif tag_ref = (tag_name(ref) && protected_tag(tag_ref))

During runtime this would basically resolve to:

    elsif tag_ref = (tag_name(ref) && protected_tag(nil))

This is because when you refer to the variable you're assigning _in_ the
assignment Ruby returns nil instead of raising an error.
2016-05-05 19:46:26 +02:00