mobley

C Git HTTP server
Log | Files | Refs | Submodules | README | git clone https://git.ne02ptzero.me/git/mobley

commit f965bc5948d8d5aba543b173e74a06fe97a46a31
parent 66eba8eeb39bad68ffebb509b17a13193c54efb4
Author: Louis Solofrizzo <lsolofrizzo@online.net>
Date:   Mon,  7 Jan 2019 12:19:22 +0100

Fix tree listing with oid URL parameter

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>

Diffstat:
Mrepository.c | 16++++++++--------
Mrepository_handler.c | 2+-
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/repository.c b/repository.c @@ -156,20 +156,20 @@ fail: bool repository_get_log_from_path_ref(repository_t *repo, const char *path, const char *ref, list_head_t *out) { - git_oid oid_parent_commit; - char branch[1024] = { 0 }; + git_commit *commit; + bool ret; if (repo->repo == NULL) return NULL; - snprintf(branch, sizeof(branch), "refs/heads/%s", ref); + commit = repository_get_last_commit(repo, ref); + if (commit == NULL) + return false; - if (git_reference_name_to_id(&oid_parent_commit, repo->repo, branch) == 0) - { - return repository_get_log_from_paths(repo, &oid_parent_commit, path, out, 1); - } + ret = repository_get_log_from_paths(repo, git_commit_id(commit), path, out, 1); - return NULL; + git_commit_free(commit); + return ret; } bool repository_get_log_from_path_default(repository_t *repo, const char *path, list_head_t *out) diff --git a/repository_handler.c b/repository_handler.c @@ -46,7 +46,7 @@ static void repository_print_tree_items(mobley_t *ctx ,server_req_t *r, list_hea } html_close("td"); INIT_LIST_HEAD(&new); - repository_get_log_from_path_default(r->repo, node->path, &new); + repository_get_log_from_path_ref(r->repo, node->path, r->branch, &new); if (list_count(&new) != 0) {