Implements the form for renaming the new filename on the file edit page
What does this MR do?
Adds the possibility to edit a filename when editing the content of a file on Gitlab
this MR was made to solve #5850 (closed)
Merge request reports
Activity
A rename in git is just a commit that has:
- Copy of the file is added
- Old file is deleted
I think we need to detect whether
@path
is different formparams[:file_name]
and do the two steps above if that is the case. I think currently this MR would just create a new file entirely but not delete the old entry.Thanks @stanhu I am going to try to find out how to do what you just said :)
Right now I am able to create a copy of the file with the new filename but I am not able to delete the previous file so we stay with a duplicate inside the repository and I think I will have to do some refactoring on the methods since I am not able to call a edit and a delete instruction in the same action (an action can only render one view but both methods need to render a view or else they will break)
Also as @stanhu mentioned to me it would be way cleaner if all of this was done inside one commit only so I may have to change the method
create_commit
to allow more than one service to be used at a time.What do you think @DouweM ?
@tiagonbotelho There are two methods that are called by those services:
- Repository#commit_file
- Repository#remove_file
I think we may need to introduce a
rename_file
that does the combination of those two methods:- Create the new blob
- Delete the old blob
I think
Blob#commit
currently can only add or remove files, but I think we can introduce something that does both actions.@stanhu totally agree on that! I'll be sure to implement it after the weekend ;) Thanks for the help
Edited by username-removed-117638@stanhu I think the method will be called
update_file
since it will update both the name of the file as the content inside it. what do you think?Added 69 commits:
-
0ffdb567...021b6aef - 64 commits from branch
gitlab-org:master
- e2e588d2 - implements the form for renaming the new filename on the file edit page
- ad799589 - successfully adds the new version with the updated name on the projects repo
- b95b23f3 - remove prints and useless comments
- 6b836637 - creates the update_file method in repository.rb and applies changes accordingly
- 53e26f27 - Merge branch 'rename-repo-files' of gitlab.com:tiagonbotelho/gitlab-ce into rename-repo-files
Toggle commit list-
0ffdb567...021b6aef - 64 commits from branch
mentioned in merge request gitlab_git!95 (merged)
Added 28 commits:
-
53e26f27...1a36493d - 20 commits from branch
gitlab-org:master
- 85d1a970 - implements the form for renaming the new filename on the file edit page
- dd161e15 - successfully adds the new version with the updated name on the projects repo
- 6b474d40 - remove prints and useless comments
- 3e97068c - refactors blob_controller
- c5630fbf - successfully adds the new version with the updated name on the projects repo
- 3824e8e1 - remove prints and useless comments
- 08c15116 - creates the update_file method in repository.rb and applies changes accordingly
- 71eadb6e - Merge branch 'rename-repo-files' of gitlab.com:tiagonbotelho/gitlab-ce into rename-repo-files
Toggle commit list-
53e26f27...1a36493d - 20 commits from branch
@tiagonbotelho Once you're done and once a miniboss has done their review, please allow me to do the final review of this MR!
Added 1 commit:
- f30d2b71 - removes debugging prints from code
Reassigned to @yorickpeterse
@yorickpeterse Could you review the MR for me please? Thanks :)
@DouweM: I'm re-assigning this to you since I'm out in the next 2 weeks, feel free to re-assign to somebody else if needed.
Reassigned to @DouweM
@tiagonbotelho Add a changelog item!