commit a2e6d162caba0a6b53c45162781de0cdbcae825a from: Stefan Sperling date: Sat Jul 27 21:11:03 2019 UTC make GOT_ERR_WORKTREE_META errors show more information commit - c3022ba5fc09b6badac00b8c123aad9d45c2e039 commit + a2e6d162caba0a6b53c45162781de0cdbcae825a blob - 83d8f86ea4a8f8daabf5d1314c75043ffc586117 blob + cbb8b461c91f58ff1ed7e56ea8b4439f80722191 --- lib/worktree.c +++ lib/worktree.c @@ -131,7 +131,7 @@ read_meta_file(char **content, const char *path_got, c fd = open(path, O_RDONLY | O_NOFOLLOW); if (fd == -1) { if (errno == ENOENT) - err = got_error(GOT_ERR_WORKTREE_META); + err = got_error_path(path, GOT_ERR_WORKTREE_META); else err = got_error_from_errno2("open", path); goto done; @@ -155,11 +155,11 @@ read_meta_file(char **content, const char *path_got, c n = read(fd, *content, sb.st_size); if (n != sb.st_size) { err = (n == -1 ? got_error_from_errno2("read", path) : - got_error(GOT_ERR_WORKTREE_META)); + got_error_path(path, GOT_ERR_WORKTREE_META)); goto done; } if ((*content)[sb.st_size - 1] != '\n') { - err = got_error(GOT_ERR_WORKTREE_META); + err = got_error_path(path, GOT_ERR_WORKTREE_META); goto done; } (*content)[sb.st_size - 1] = '\0'; @@ -355,7 +355,8 @@ open_worktree(struct got_worktree **worktree, const ch version = strtonum(formatstr, 1, INT_MAX, &errstr); if (errstr) { - err = got_error(GOT_ERR_WORKTREE_META); + err = got_error_msg(GOT_ERR_WORKTREE_META, + "could not parse work tree format version number"); goto done; } if (version != GOT_WORKTREE_FORMAT_VERSION) {