commit 1233e6b6715afa716b042fc369d0becc3bb9f58f from: Stefan Sperling date: Mon Oct 19 23:14:59 2020 UTC switch to got_path_basename in revert_file ok millert commit - 562386c58b14079697d80948b00aed963cc1557e commit + 1233e6b6715afa716b042fc369d0becc3bb9f58f blob - 1c36cc66e308756a1e4d87c0e625f934a016272f blob + e8828ca377630832d832969eb9de9ef7450bd503 --- lib/worktree.c +++ lib/worktree.c @@ -4410,13 +4410,12 @@ revert_file(void *arg, unsigned char status, unsigned if (err) goto done; - te_name = basename(ie->path); - if (te_name == NULL) { - err = got_error_from_errno2("basename", ie->path); + err = got_path_basename(&te_name, ie->path); + if (err) goto done; - } te = got_object_tree_find_entry(tree, te_name); + free(te_name); if (te == NULL && status != GOT_STATUS_ADD && staged_status != GOT_STATUS_ADD) { err = got_error_path(ie->path, GOT_ERR_NO_TREE_ENTRY);