diff options
-rw-r--r-- | acl.go | 2 | ||||
-rw-r--r-- | http_handle_repo_index.go | 10 | ||||
-rw-r--r-- | ssh_handle_receive_pack.go | 2 | ||||
-rw-r--r-- | ssh_handle_upload_pack.go | 2 | ||||
-rw-r--r-- | ssh_utils.go | 2 |
5 files changed, 10 insertions, 8 deletions
@@ -11,7 +11,7 @@ import ( // get_path_perm_by_group_repo_key returns the filesystem path and direct // access permission for a given repo and a provided ssh public key. -func get_path_perm_by_group_repo_key(ctx context.Context, group_path []string, repo_name, ssh_pubkey string) (repo_id int, filesystem_path string, access bool, contrib_requirements string, user_type string, user_id int, err error) { +func get_path_perm_by_group_repo_key(ctx context.Context, group_path []string, repo_name, ssh_pubkey string) (repo_id int, filesystem_path string, access bool, contrib_requirements, user_type string, user_id int, err error) { err = database.QueryRow(ctx, ` WITH RECURSIVE group_path_cte AS ( -- Start: match the first name in the path where parent_group IS NULL diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index e4a9f5d..da06500 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -9,8 +9,8 @@ import ( "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" - "github.com/go-git/go-git/v5/plumbing/storer" "github.com/go-git/go-git/v5/plumbing/object" + "github.com/go-git/go-git/v5/plumbing/storer" ) func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string]any) { @@ -38,12 +38,14 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string } branches_, err = repo.Branches() - if err != nil {} - err = branches_.ForEach(func (branch *plumbing.Reference) error { + if err != nil { + } + err = branches_.ForEach(func(branch *plumbing.Reference) error { branches = append(branches, branch.Name().Short()) return nil }) - if err != nil {} + if err != nil { + } params["branches"] = branches if recent_commits, err = get_recent_commits(repo, ref_hash, 3); err != nil { diff --git a/ssh_handle_receive_pack.go b/ssh_handle_receive_pack.go index b77b717..3f7c1f1 100644 --- a/ssh_handle_receive_pack.go +++ b/ssh_handle_receive_pack.go @@ -31,7 +31,7 @@ type pack_to_hook_t struct { var pack_to_hook_by_cookie = cmap.Map[string, pack_to_hook_t]{} // ssh_handle_receive_pack handles attempts to push to repos. -func ssh_handle_receive_pack(session glider_ssh.Session, pubkey string, repo_identifier string) (err error) { +func ssh_handle_receive_pack(session glider_ssh.Session, pubkey, repo_identifier string) (err error) { group_path, repo_name, repo_id, repo_path, direct_access, contrib_requirements, user_type, user_id, err := get_repo_path_perms_from_ssh_path_pubkey(session.Context(), repo_identifier, pubkey) if err != nil { return err diff --git a/ssh_handle_upload_pack.go b/ssh_handle_upload_pack.go index fbbdfda..0aa2f17 100644 --- a/ssh_handle_upload_pack.go +++ b/ssh_handle_upload_pack.go @@ -13,7 +13,7 @@ import ( // ssh_handle_upload_pack handles clones/fetches. It just uses git-upload-pack // and has no ACL checks. -func ssh_handle_upload_pack(session glider_ssh.Session, pubkey string, repo_identifier string) (err error) { +func ssh_handle_upload_pack(session glider_ssh.Session, pubkey, repo_identifier string) (err error) { var repo_path string if _, _, _, repo_path, _, _, _, _, err = get_repo_path_perms_from_ssh_path_pubkey(session.Context(), repo_identifier, pubkey); err != nil { return err diff --git a/ssh_utils.go b/ssh_utils.go index d40facf..ac0781e 100644 --- a/ssh_utils.go +++ b/ssh_utils.go @@ -16,7 +16,7 @@ import ( var err_ssh_illegal_endpoint = errors.New("illegal endpoint during SSH access") -func get_repo_path_perms_from_ssh_path_pubkey(ctx context.Context, ssh_path string, ssh_pubkey string) (group_path []string, repo_name string, repo_id int, repo_path string, direct_access bool, contrib_requirements string, user_type string, user_id int, err error) { +func get_repo_path_perms_from_ssh_path_pubkey(ctx context.Context, ssh_path, ssh_pubkey string) (group_path []string, repo_name string, repo_id int, repo_path string, direct_access bool, contrib_requirements, user_type string, user_id int, err error) { var segments []string var separator_index int var module_type, module_name string |