Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file tree to file view page #32721

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
181645f
add tree sidebar to file view
kerwin612 Dec 12, 2024
59e46d4
Merge branch 'add-tree-sidebar-2-file-view' into add-file-tree-to-fil…
kerwin612 Dec 13, 2024
c4e7f0c
add tree sidebar to file view
kerwin612 Dec 13, 2024
68ef9ef
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Dec 16, 2024
64b4cf4
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Dec 16, 2024
b60ee86
Add tree
lunny Dec 16, 2024
07fb84f
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Dec 23, 2024
a28b65d
complete first version
lunny Dec 24, 2024
38de8aa
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Dec 24, 2024
a86c9e4
Merge branch 'main' into add-file-tree-to-file-view-page
lunny Dec 24, 2024
e46f7e4
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Dec 24, 2024
023a260
Merge branch 'add-file-tree-to-file-view-page' into add-file-tree-to-…
kerwin612 Dec 24, 2024
6cb22e5
Merge pull request #2 from lunny/add-file-tree-to-file-view-page
kerwin612 Dec 24, 2024
3b3eaec
Fix todo
lunny Dec 24, 2024
f2b1da5
Fix bug
lunny Dec 24, 2024
a1830dc
Merge pull request #3 from lunny/add-file-tree-to-file-view-page
kerwin612 Dec 24, 2024
76a5614
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Dec 24, 2024
158b79e
debug new api /tree
kerwin612 Dec 25, 2024
143249f
change loading
kerwin612 Dec 26, 2024
634fbe0
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Dec 26, 2024
15f4b92
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Dec 26, 2024
2178347
add function for recusive
lunny Dec 26, 2024
9ae1c85
Fix bug
lunny Dec 26, 2024
a19a972
Merge branch 'main' into kerwin612-add-file-tree-to-file-view-page
lunny Dec 26, 2024
e860a36
Add more comment
lunny Dec 26, 2024
1a1fe32
Fix bug
lunny Dec 26, 2024
bf15e18
Fix bug
lunny Dec 26, 2024
91ffb2d
fix bug
kerwin612 Dec 27, 2024
b1b2428
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Jan 3, 2025
fe63c5f
Fix test
lunny Jan 3, 2025
087f0d4
fix
kerwin612 Jan 3, 2025
09000c4
Fix bug
lunny Jan 3, 2025
a1cee9e
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Jan 3, 2025
2a8f9c8
fix
kerwin612 Jan 3, 2025
ad9b126
fix
kerwin612 Jan 6, 2025
c949f42
fix
kerwin612 Jan 6, 2025
64c7e08
Fix bug
lunny Jan 6, 2025
cd3a9af
implement save user ShowFileViewTreeSidebar
lunny Jan 6, 2025
cdf05fb
Add missing changes
lunny Jan 6, 2025
647cd30
Remove unused file
lunny Jan 6, 2025
91f972c
fix
kerwin612 Jan 6, 2025
07e4896
fix lint error
kerwin612 Jan 6, 2025
96e050e
Fix bugs
lunny Jan 6, 2025
1fd53fd
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Jan 6, 2025
6b86304
fix
kerwin612 Jan 6, 2025
a125a58
Fix test
lunny Jan 6, 2025
87ed579
Fix test
lunny Jan 6, 2025
d675289
Fix bug
lunny Jan 6, 2025
2000a67
remove unused code
lunny Jan 6, 2025
335375f
merge main
kerwin612 Jan 10, 2025
34dc5b1
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Jan 10, 2025
be7a6b6
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Jan 10, 2025
3e679d6
fix
kerwin612 Jan 10, 2025
6734237
Merge branch 'upstream_main' into add-file-tree-to-file-view-page
kerwin612 Jan 10, 2025
6441fe5
Merge remote-tracking branch 'refs/remotes/kerwin612/add-file-tree-to…
kerwin612 Jan 10, 2025
f769c8b
Make template simpler
lunny Jan 10, 2025
818ad6a
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Jan 10, 2025
9b95582
fix
kerwin612 Jan 10, 2025
0cafe2a
fix
kerwin612 Jan 10, 2025
c2670db
fix
kerwin612 Jan 10, 2025
62ecf34
Merge branch 'main' into add-file-tree-to-file-view-page
kerwin612 Jan 10, 2025
d4a99e5
fix
kerwin612 Jan 10, 2025
eff3568
Merge branch 'main' into kerwin612-add-file-tree-to-file-view-page
lunny Jan 13, 2025
616fe58
Remove unused code
lunny Jan 13, 2025
3c86322
Fix bug
lunny Jan 13, 2025
67a749f
Some renames and use type instead of isFile
lunny Jan 13, 2025
c0e2fd2
fix
kerwin612 Jan 13, 2025
ab98bfb
Fix bug
lunny Jan 13, 2025
cac5f1c
Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin61…
lunny Jan 13, 2025
dc63b48
fix
kerwin612 Jan 13, 2025
fe21290
fix
kerwin612 Jan 13, 2025
a55548f
fix
kerwin612 Jan 13, 2025
0b44132
Merge branch 'main' into kerwin612-add-file-tree-to-file-view-page
lunny Jan 13, 2025
4890434
some improvements
lunny Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions modules/git/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ func RefNameFromCommit(shortName string) RefName {
return RefName(shortName)
}

func RefNameFromTypeAndShortName(tp RefType, shortName string) RefName {

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you insist that it is right, you could open a new PR to refactor existing code (for example: /tree-list) to use the new mechanism first.

switch tp {
case RefTypeBranch:
return RefNameFromBranch(shortName)
case RefTypeTag:
return RefNameFromTag(shortName)
case RefTypeCommit:
return RefNameFromCommit(shortName)
default:
return ""
}
}

func (ref RefName) String() string {
return string(ref)
}
Expand Down
14 changes: 5 additions & 9 deletions routers/web/repo/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,12 @@ func isExcludedEntry(entry *git.TreeEntry) bool {

func Tree(ctx *context.Context) {
treePath := ctx.PathParam("*")
var refFullName git.RefName
switch ctx.FormTrim("ref_type") {
case "branch":
refFullName = git.RefNameFromBranch(ctx.FormTrim("ref_name"))
case "tag":
refFullName = git.RefNameFromTag(ctx.FormTrim("ref_name"))
default:
refFullName = git.RefName(ctx.FormTrim("ref_name"))
}
recursive := ctx.FormBool("recursive")
refFullName := git.RefNameFromTypeAndShortName(git.RefType(ctx.FormTrim("ref_type")), ctx.FormTrim("ref_name"))
if refFullName == "" {
ctx.Error(http.StatusBadRequest, "RefNameFromTypeAndShortName", "ref_type or ref_name is invalid")
return
}

var results []*files_service.TreeViewNode
var err error
Expand Down
Loading