From: Stefan Sperling Subject: fix tog log view -> tree view switching To: gameoftrees@openbsd.org Cc: naddy@openbsd.org Date: Sun, 12 Jan 2020 17:11:55 +0100 naddy@ noticed that this throws an error: $ tog log usr.bin/ssh hit 't' for tree view tog: : no such entry found in tre The patch below fixes the issue for me. Makes sense? diff 6a91d28331c6c2bf720d27325d5655cfbc8b9248 /home/stsp/src/got blob - c1f1819aab4eca2209fa34a6d51e81350c702c96 file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -1795,19 +1795,20 @@ browse_commit_tree(struct tog_view **new_view, int beg /* Walk the path and open corresponding tree objects. */ p = path; - while (p[0] == '/') - p++; while (*p) { struct got_tree_entry *te; struct got_object_id *tree_id; char *te_name; + while (p[0] == '/') + p++; + /* Ensure the correct subtree entry is selected. */ slash = strchr(p, '/'); if (slash == NULL) - slash = strchr(p, '\0'); - - te_name = strndup(p, slash -p); + te_name = strdup(p); + else + te_name = strndup(p, slash - p); if (te_name == NULL) { err = got_error_from_errno("strndup"); break;