commit 23721109e309187ba1da65d068dc11ccf30fe835 from: Stefan Sperling date: Mon Oct 22 21:47:25 2018 UTC fix logging /sys in tog while /sys symlink exists on disk commit - 797bc7b9c23dea7041e152b5fe410c0c762eb416 commit + 23721109e309187ba1da65d068dc11ccf30fe835 blob - 398bd39abcf67f6c7ff362b0deb47a88374598e0 blob + d390e0e9923fdb62cd4a0ef9bd47b0c99499fa7e --- got/got.c +++ got/got.c @@ -551,7 +551,7 @@ cmd_log(int argc, char *argv[]) goto done; } - error = got_repo_map_path(&in_repo_path, repo, path); + error = got_repo_map_path(&in_repo_path, repo, path, 1); if (error != NULL) goto done; if (in_repo_path) { @@ -749,7 +749,7 @@ cmd_blame(int argc, char *argv[]) if (error != NULL) goto done; - error = got_repo_map_path(&in_repo_path, repo, path); + error = got_repo_map_path(&in_repo_path, repo, path, 1); if (error != NULL) goto done; @@ -905,7 +905,7 @@ cmd_tree(int argc, char *argv[]) if (error != NULL) goto done; - error = got_repo_map_path(&in_repo_path, repo, path); + error = got_repo_map_path(&in_repo_path, repo, path, 1); if (error != NULL) goto done; blob - 2fd4ddd312ea5fb19ea1ae92f79f49a045bb517b blob + 37f50bb121ab922394e63c883653fa25db30d824 --- include/got_repository.h +++ include/got_repository.h @@ -45,4 +45,4 @@ int got_repo_is_bare(struct got_repository *); /* Attempt to map an arbitrary path to a path within the repository. */ const struct got_error *got_repo_map_path(char **, struct got_repository *, - const char *); + const char *, int); blob - d45495d120dd2536e096a1bb2020674dd2569731 blob + d82e38e345a904ababe7f97b02142d026947c304 --- lib/repository.c +++ lib/repository.c @@ -433,13 +433,13 @@ got_repo_close(struct got_repository *repo) const struct got_error * got_repo_map_path(char **in_repo_path, struct got_repository *repo, - const char *input_path) + const char *input_path, int check_disk) { const struct got_error *err = NULL; char *repo_abspath = NULL, *cwd = NULL; struct stat sb; size_t repolen, cwdlen, len; - char *canonpath, *path; + char *canonpath, *path = NULL; *in_repo_path = NULL; @@ -464,7 +464,9 @@ got_repo_map_path(char **in_repo_path, struct got_repo /* TODO: Call "get in-repository path of work-tree node" API. */ - if (lstat(canonpath, &sb) != 0) { + if (!check_disk) + path = strdup(canonpath); + else if (lstat(canonpath, &sb) != 0) { if (errno != ENOENT) { err = got_error_from_errno(); goto done; blob - 220eb8ceb0493512a82f2c08d172311605f37f14 blob + c90730d590e4ba7275acd95c527f87e190991447 --- tog/tog.c +++ tog/tog.c @@ -270,7 +270,7 @@ static const struct got_error *input_diff_view(struct static const struct got_error* close_diff_view(struct tog_view *); static const struct got_error *open_log_view(struct tog_view *, - struct got_object_id *, struct got_repository *, const char *); + struct got_object_id *, struct got_repository *, const char *, int); static const struct got_error * show_log_view(struct tog_view *); static const struct got_error *input_log_view(struct tog_view **, struct tog_view **, struct tog_view **, struct tog_view *, int); @@ -1360,7 +1360,7 @@ close_log_view(struct tog_view *view) static const struct got_error * open_log_view(struct tog_view *view, struct got_object_id *start_id, - struct got_repository *repo, const char *path) + struct got_repository *repo, const char *path, int check_disk) { const struct got_error *err = NULL; struct tog_log_view_state *s = &view->state.log; @@ -1368,7 +1368,7 @@ open_log_view(struct tog_view *view, struct got_object struct got_commit_graph *thread_graph = NULL; int errcode; - err = got_repo_map_path(&s->in_repo_path, repo, path); + err = got_repo_map_path(&s->in_repo_path, repo, path, check_disk); if (err != NULL) goto done; @@ -1566,7 +1566,7 @@ input_log_view(struct tog_view **new_view, struct tog_ if (lv == NULL) return got_error_from_errno(); err = open_log_view(lv, s->start_id, s->repo, - parent_path); + parent_path, 0); if (err) return err;; if (view_is_parent_view(view)) @@ -1669,7 +1669,7 @@ cmd_log(int argc, char *argv[]) error = got_error_from_errno(); goto done; } - error = open_log_view(view, start_id, repo, path); + error = open_log_view(view, start_id, repo, path, 1); if (error) goto done; error = view_loop(view); @@ -2755,7 +2755,7 @@ cmd_blame(int argc, char *argv[]) if (error != NULL) return error; - error = got_repo_map_path(&in_repo_path, repo, path); + error = got_repo_map_path(&in_repo_path, repo, path, 1); if (error != NULL) goto done; @@ -3048,7 +3048,7 @@ log_tree_entry(struct tog_view **new_view, int begin_x if (err) return err; - err = open_log_view(log_view, commit_id, repo, path); + err = open_log_view(log_view, commit_id, repo, path, 0); if (err) view_close(log_view); else