Skip to content
Snippets Groups Projects

Add directory feature button

Merged Stan Hu requested to merge stanhu/gitlab-ce:add-directory-feature into master

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

image

image

image

Added branch capability to upload file form:

image

"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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Douwe Maan
    Douwe Maan @DouweM started a thread on the diff
  • 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')
  • Stan Hu Added 42 commits:

    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
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • a9913b98 - Move create_dir functionality from blob to tree controller
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • ab8abded - Make button less prominent and simplify tree permission check
  • 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 ?

  • Author Maintainer

    @DouweM Yes, actually, I found a much simpler way of implementing mkdir and mkdir -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 but CreateService 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 Hu
  • Stan Hu Added 175 commits:

    Added 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
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • 7ac89058 - Fix spec
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • c57d1df0 - Move branch block to bottom part of form to be consistent
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • 99cc8481 - Add directory feature button
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • a5c335ff - Add directory feature button
  • Stan Hu Title changed from WIP: Add directory feature button to Add directory feature button

    Title changed from WIP: Add directory feature button to Add directory feature button

  • Author Maintainer

    @DouweM, ok, I think this is ready to go. Please review when you have time. Thanks!

  • Stan Hu Added 1 commit:

    Added 1 commit:

    • 3dbbe747 - Remove extraneous strip (gitlab_git handles this)
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • 75a5886f - Add directory feature button
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • f5361263 - Add directory feature button
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • a78eab3f - Add directory feature button
  • Awesome! Now get yourself a changelog item ;)

  • Stan Hu Added 46 commits:

    Added 46 commits:

    • a78eab3f...0611a189 - 45 commits from branch gitlab-org:master
    • d59d818c - Add directory feature button
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • c7c39535 - Add directory feature button
  • Stan Hu Added 1 commit:

    Added 1 commit:

    • 0ab6ca93 - Add directory feature button
  • Douwe Maan Status changed to merged

    Status changed to merged

  • Douwe Maan mentioned in commit cc8c91a1

    mentioned in commit cc8c91a1

  • Thanks everyone, especially @stanhu. Very helpful!

  • @stanhu wow thats amazing! Dropdown on first screen looks awesome! Much better that creating new file and looking for upload link! :hearts:

  • Author Maintainer

    Thanks, everyone! Much kudos to Douwe for reviewing this thoroughly. Now use this feature for good. :)

  • 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?

  • Author Maintainer

    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.

  • Please register or sign in to reply
    Loading