Commit Graph

17 Commits

Author SHA1 Message Date
Valery Sizov 501ce37f83 Fix of 'Commits being passed to custom hooks are already reachable when using the UI' 2016-07-19 07:45:22 +03:00
Valery Sizov 3baed8cb6d Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
Valery Sizov bf218337ed Better message for git hooks and file locks 2016-07-04 15:31:49 +03:00
Rémy Coutable 209f2f1e6f Use a similar approach to branch creation for tag creation
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-05-04 17:19:13 +02:00
Stan Hu 4603e57147 Fix duplicated branch creation/deletion Web hooks/service notifications when using Web UI
Similar to 423d2d6, except duplicates occurred only if a Web service (e.g. Slack) were
configured.

When deleting a branch, this is what was happening:

    1. DeleteBranchService calls execute_hooks and execute_services
    2. The call to repository.rm_branch triggers the GitHooksService.
    3. This, in turn, calls GitPushService and then calls the same hooks/services again.

5145706 now makes it no longer necessary for DeleteBranchService and CreateBranchService to execute
the branch hooks/services. Note that tags behave differently in GitTagPushService and GitPushService
is not called.

Closes #10330
2016-02-09 06:22:49 -08:00
Stan Hu 423d2d621a Fix duplicated branch creation/deletion events when using Web UI
When deleting a branch, this is what was happening:

1. DeleteBranchService calls EventCreateService and creates an event.
2. The call to repository.rm_branch triggers the GitHooksService.
3. This, in turn, calls GitPushService and then calls EventCreateService again.

5145706c now makes it no longer necessary for DeleteBranchService and CreateBranchService to create an event.

Closes #4304
2016-01-08 00:37:41 -08:00
Dmitriy Zaporozhets 76b7e24f85 Merge branch 'edit-on-fork' into 'master'
Automatically fork a project when not allowed to edit a file.

Fixes #3215.

To do:

- [ ] Add tests

-----

## "Edit" button on file in a project the user does NOT have write access to

![edit_file](/uploads/7602157420768aef483a6586bba2d164/edit_file.png)

## Clicking will automatically create a fork

![during_fork](/uploads/32f4f5dff9f24ea99522000b0bf881c5/during_fork.png)

## When the fork has been created, the user is returned to the edit page on the original project with a notice

![edit_notice](/uploads/94ed1319404370ff1e9c0d672fb41e03/edit_notice.png)

## The user cannot change the target branch and is informed that editing will start an MR

![edit_footer](/uploads/4da68d4795c7177e575b7c434d16eeae/edit_footer.png)

## Hitting "Commit changes" will commit and start an MR from my fork to the origin project

![Screen_Shot_2015-12-17_at_23.38.08](/uploads/d777a4db6f38a5a1be84031694465bc1/Screen_Shot_2015-12-17_at_23.38.08.png)

-----

## "Create file, "Upload file" and "New directory" buttons in a project the user does NOT have write access to

![new_directory](/uploads/72f556248f30d6652523bbb4be01b3e0/new_directory.png)

## Clicking any of these options will automatically create a fork

![during_fork](/uploads/32f4f5dff9f24ea99522000b0bf881c5/during_fork.png)

## When the fork has been created, the user is returned to the tree page on the original project with a notice

![new_directory_notice](/uploads/a1a3e11308ae0e8f0913fae6813a37ed/new_directory_notice.png)

## Clicking "New directory" again will show the modal. The user cannot change the target branch and is informed that editing will start an MR

![new_dir](/uploads/99ca8cbfb2f70603e352b3fdf67b6281/new_dir.png)

## Hitting "Create directory" will commit and start an MR from my fork to the origin project

![Screen_Shot_2015-12-17_at_23.39.19](/uploads/3713d0235abf831361b803a6198c5bc1/Screen_Shot_2015-12-17_at_23.39.19.png)

cc @dzaporozhets @skyruler

See merge request !2145
2015-12-24 12:24:57 +00:00
Douwe Maan d9c82d679f Automatically fork a project when not allowed to edit a file. 2015-12-18 10:03:34 +01:00
Douglas Barbosa Alexandre 1757e6ef65 Add JS validation for invalid characters in branch name
More info about valid ref names:

https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.ht
ml
2015-12-17 17:17:37 -02:00
Douglas Barbosa Alexandre 9c266d4935 Add more descriptive error message when create branch with invalid name 2015-12-16 16:34:03 -02:00
Rubén Dávila 5145706c82 Run custom Git hooks when creating or deleting branches through the UI. #1156 2015-12-03 09:39:15 -05:00
Douwe Maan 10421674af Ecevute hooks and services when branches are created/deleted through web. 2015-03-13 16:07:02 +01:00
Douwe Maan 84d28209b6 Use PushDataBuilder where applicable. 2015-03-13 16:06:56 +01:00
Douwe Maan 07d05d2df7 Move all event creation to EventCreateService. 2015-02-13 12:02:58 +01:00
Ciro Santilli ad47993ac4 Factor error and success methods from services. 2014-09-21 11:43:05 +02:00
Robert Schilling 551145bc98 Validate branch-names and references in WebUI, API
Add specs for GitRefValidator
2014-09-03 13:08:35 +02:00
Dmitriy Zaporozhets 95b84e2c5a
Move branch creation logic in service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-01 10:33:23 +03:00