From cfc8bd2bd3930fc91847a71a8d0092c2c85b0f4a Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 09:19:54 +0800 Subject: repo_index: Add repo descriptions --- git_misc.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'git_misc.go') diff --git a/git_misc.go b/git_misc.go index c153534..7b7febb 100644 --- a/git_misc.go +++ b/git_misc.go @@ -18,13 +18,14 @@ var ( err_getting_parent_commit_object = errors.New("Error getting parent commit object") ) -func open_git_repo(ctx context.Context, group_name, repo_name string) (*git.Repository, error) { +func open_git_repo(ctx context.Context, group_name, repo_name string) (repo *git.Repository, description string, err error) { var fs_path string - err := database.QueryRow(ctx, "SELECT r.filesystem_path FROM repos r JOIN groups g ON r.group_id = g.id WHERE g.name = $1 AND r.name = $2;", group_name, repo_name).Scan(&fs_path) + err = database.QueryRow(ctx, "SELECT r.filesystem_path, r.description FROM repos r JOIN groups g ON r.group_id = g.id WHERE g.name = $1 AND r.name = $2;", group_name, repo_name).Scan(&fs_path, &description) if err != nil { - return nil, err + return nil, "", err } - return git.PlainOpen(fs_path) + repo, err = git.PlainOpen(fs_path) + return } type display_git_tree_entry_t struct { -- cgit v1.2.3