Commit graph

24 commits

Author SHA1 Message Date
Douwe Maan
f2464a1321 Don't require start branch to exist if we're just creating a new branch 2017-03-02 08:59:57 -06:00
Douwe Maan
8ca9bf1d3b Fix variable name and change copy 2017-03-01 14:29:33 -06:00
Douwe Maan
80543e0abd Fix creating a file in an empty repo using the API 2017-03-01 12:25:21 -06:00
Lin Jen-Shin
8f3aa6ac33 Try to check if branch diverged explicitly
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_21627134
2017-01-26 21:59:12 +08:00
Lin Jen-Shin
05f4e48a4c Make GitHooksService#execute return block value
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_21627207
2017-01-26 19:35:19 +08:00
Lin Jen-Shin
ccc73c455b Rename from base to start because base could mean merge base 2017-01-06 23:29:13 +08:00
Lin Jen-Shin
a4b97b2cb6 Rename source to base to avoid confusion from MR 2017-01-06 22:05:30 +08:00
Lin Jen-Shin
e01c692a35 Remove tag with git hooks 2017-01-05 02:53:45 +08:00
Lin Jen-Shin
99ac093527 Introduce Repository#with_repo_branch_commit
We merge repository checks inside it so we don't have to
check it on the call site, and we could also load the commit
for the caller. This greatly reduce code duplication.

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_20572919
2017-01-05 01:52:21 +08:00
Lin Jen-Shin
05d742a047 Indent the way rubocop likes 2017-01-05 01:10:35 +08:00
Lin Jen-Shin
ecac2f1122 Update the comment:
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_20876648
2017-01-04 22:50:01 +08:00
Lin Jen-Shin
14c4db2ae4 Add a comment to explain why newrev should be updated
Feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_20301332
2017-01-04 22:31:06 +08:00
Lin Jen-Shin
56d131dcd5 Use ArgumentError error instead because it's a bug
if it happens. Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19747933
2016-12-14 03:40:01 +08:00
Lin Jen-Shin
944a8fa4d2 Use branch_exists? to check branches
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19747922
2016-12-14 03:00:16 +08:00
Lin Jen-Shin
d03c605bd4 Unify parameters and callback after hooks
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19747856
2016-12-14 02:29:35 +08:00
Lin Jen-Shin
46d752ce21 Use a regular class for GitOperationService
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19747793
2016-12-14 02:03:04 +08:00
Lin Jen-Shin
bb9d30590d Pass source_commit so that we save a few lookups 2016-12-10 00:40:23 +08:00
Lin Jen-Shin
8384d0d8d5 Introduce Repository#with_tmp_ref which we need
commits from the other repository. We'll cleanup
the tmp ref after we're done with our business.
2016-12-08 17:57:52 +08:00
Lin Jen-Shin
23032467d4 source_branch -> source_branch_name 2016-12-08 17:27:50 +08:00
Lin Jen-Shin
3fa3fcd787 Cleanup parameters, easier to understand and
more consistent across different methodst
2016-12-08 17:08:25 +08:00
Lin Jen-Shin
5ecd0c81af Commit outside the hooks if possible:
So we still commit outside the hooks, and only
update ref inside the hooks. There are only two
exceptions:

* Whenever it's adding a tag. We can't add a tag
  without committing, unfortunately. See !7700
* Whenever source project is in another repository.
  We'll need to fetch ref otherwise commits can't be made.

See the whole discussion starting from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19210942
2016-12-07 22:37:43 +08:00
Lin Jen-Shin
6ae1a73cfd Pass source_branch properly for cherry-pick/revert
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237/diffs#note_19210818
2016-12-07 19:50:08 +08:00
Lin Jen-Shin
65806ec632 Re-enable tests for update_branch_with_hooks and
Add back check if we're losing commits in a merge.
2016-12-06 18:47:24 +08:00
Lin Jen-Shin
a52dc7cec7 Introduce GitOperationService and wrap every
git operation inside GitHooksService. Feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19210942

TODO: Fix tests for update_branch_with_hooks
2016-12-06 03:13:15 +08:00