Add directory feature button
This MR adds the "Add directory" feature as described in #2557 (closed) and splits out the "Create file" and "Upload file" in a dropdown.
Screenshots
Added branch capability to upload file form:
"Upload file" is no longer accessible from the "Create file" page. Users can now select a target branch in upload file as well.
Closes #2799 (closed): Fixes a bug where file modes were overwritten after a commit
Closes https://github.com/gitlabhq/gitlabhq/issues/8253: Existing files can no longer be overwritten in the "Create file" section.
Closes #2557 (closed)
Merge request reports
Activity
Added 27 commits:
-
c165864a...5b7e491c - 25 commits from branch
gitlab-org:master
- bdf8f301 - Add directory feature button
- 680ae00f - Fix existing tests
-
c165864a...5b7e491c - 25 commits from branch
Reassigned to @DouweM
@DouweM, I'm really happy that I finally got this MR done. Would you mind reviewing this and the gitlab_git changes?
10 10 = link_to title, '#' 11 11 - if current_user && can_push_branch?(@project, @ref) 12 12 %li 13 = link_to namespace_project_new_blob_path(@project.namespace, @project, @id), title: 'New file', id: 'new-file-link' do 14 %small 15 %i.fa.fa-plus 13 %span.dropdown 14 %a.dropdown-toggle.btn.btn-sm.btn-new{href: '#', "data-toggle" => "dropdown"} 15 = icon('plus') @stanhu Would you mind updating the screenshots?
Added 42 commits:
- 20f0b082...2e8a3e39 - 37 commits from branch
gitlab-org:master
- 96000e63 - Add directory feature button
- 4fe73fda - Remove "upload an existing one" text from "Create a new file" page
- 041b8390 - Add test for directory creation failure
- 30e49df5 - Review cleanup
- ab9ed0ea - Fix typo
Toggle commit list- 20f0b082...2e8a3e39 - 37 commits from branch
I like to have the possibility to create directories from the ui, but I would prefer to create a directory with the "create file" function. So if I create a file "d/i/r/file.ext", it would be great if the directories "d", "d/i", and "d/i/r" would be created too. At the moment the "d/i/r" information will be dropped and the file will be created in the current root directory.
@boeserwolf91 Good idea! Once we have the functionality for creating directories, that should be relatively easy to implement. What do you think @stanhu ?
@DouweM Yes, actually, I found a much simpler way of implementing
mkdir
andmkdir -p
using the Rugged repo index, which will also make it very easy to support creating directories directly via the create file function. In fact, I think the functionality is already there butCreateService
prevents filenames with slashes at the moment.I don't know why I was having so many problems earlier. I guess I was trying to add a Rugged tree to the bare repository index, which you can't do. You can, however, add arbitrary file paths, and Rugged will automatically do the right thing.
Edited by Stan HuAdded 175 commits:
- ab8abded...97f7edf3 - 167 commits from branch
gitlab-org:master
- 8eb93977 - Add directory feature button
- 18087430 - Remove "upload an existing one" text from "Create a new file" page
- 4e897926 - Add test for directory creation failure
- 3dae77e5 - Review cleanup
- b73df529 - Fix typo
- 72288d3b - Move create_dir functionality from blob to tree controller
- 6864ddae - Make button less prominent and simplify tree permission check
- e6439248 - Allow specifying branch names in create dir and upload file feature
Toggle commit list- ab8abded...97f7edf3 - 167 commits from branch
@DouweM, ok, I think this is ready to go. Please review when you have time. Thanks!
Added 46 commits:
- a78eab3f...0611a189 - 45 commits from branch
gitlab-org:master
- d59d818c - Add directory feature button
- a78eab3f...0611a189 - 45 commits from branch
Added 1 commit:
- 0ab6ca93 - Add directory feature button
mentioned in commit cc8c91a1
Thanks everyone, especially @stanhu. Very helpful!
Wow, thanks @stanhu
Wow, thanks @stanhu
@stanhu wow thats amazing! Dropdown on first screen looks awesome! Much better that creating new file and looking for upload link!
Thanks for this feature! However it is unclear to me if the extension of this feature as described here https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1453#note_2228243 (create a directory with the "create file" function) has been implemented / is already planned / or still just a wishlist item?
No, this MR focuses only on the creation of the directory. Supporting the "create directory with the create file" function should be easy; I think it's just a matter of removing the restriction of having slashes in the filename and making the UI clear that slashes are allowed. I won't have time to work on it for a while, but feel free to take a crack at it.