Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/file.v
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ fn (mut app App) add_file(file File) ! {

fn (mut app App) find_repository_items(repo_id int, branch string, parent_path string) []File {
valid_parent_path := if parent_path == '' { '.' } else { parent_path }
// app.debug("parent_path: ${parent_path} valid_parent_path: ${valid_parent_path}")

items := sql app.db {
select from File where repo_id == repo_id && parent_path == valid_parent_path
Expand Down
6 changes: 4 additions & 2 deletions src/repo.v
Original file line number Diff line number Diff line change
Expand Up @@ -809,9 +809,11 @@ fn (r &Repo) read_file(branch string, path string) string {
return 'nil'
}
t := time.now()
// s := r.git('--no-pager show ${branch}:${valid_path}')
// works. Uncommented:
s := r.git('--no-pager show ${branch}:${valid_path}')

s := r.git_repo.show_file_blob(branch, valid_path) or { '' }
// doesn't work, commented out:
// s := r.git_repo.show_file_blob(branch, valid_path) or { '' }
println(time.since(t))
println(':)')
return s
Expand Down
5 changes: 4 additions & 1 deletion src/repo_routes.v
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ pub fn (mut app App) tree(mut ctx Context, username string, repo_name string, br
branch := app.find_repo_branch_by_name(repo.id, branch_name)

app.info('${log_prefix}: ${items.len} items found in branch ${branch_name}')
println(items)
// println(items)

if items.len == 0 {
// No files in the db, fetch them from git and cache in db
Expand Down Expand Up @@ -404,6 +404,7 @@ pub fn (mut app App) tree(mut ctx Context, username string, repo_name string, br
items = []
items << dirs
items << files
// app.debug('${items.len} items')

commits_count := app.get_repo_commit_count(repo.id, branch.id)
has_commits := commits_count > 0
Expand Down Expand Up @@ -485,10 +486,12 @@ pub fn (mut app App) contributors(mut ctx Context, username string, repo_name st

@['/:username/:repo_name/blob/:branch_name/:path...']
pub fn (mut app App) blob(mut ctx Context, username string, repo_name string, branch_name string, path string) veb.Result {
// app.debug("app.blob(): path: ${path}")
repo := app.find_repo_by_name_and_username(repo_name, username) or { return ctx.not_found() }

mut path_parts := path.split('/')
path_parts.pop()
// app.debug("app.blob(): path_parts: ${path_parts}")

ctx.current_path = path
ctx.path_split = [repo_name]
Expand Down