Commit Diff


commit - f77a24b0362de269128c9588d65818958a9ec9a9
commit + f02eaa22e5963774a1ad9810e415ab201552ec8c
blob - c51294c40d0102c2062dc9d4c9a0a541dd28d5de
blob + c31c617a30892baa3483b16afaa9cab24260757a
--- lib/worktree.c
+++ lib/worktree.c
@@ -146,7 +146,10 @@ read_meta_file(char **content, const char *path_got, c
 
 	fd = open(path, O_RDONLY | O_NOFOLLOW);
 	if (fd == -1) {
-		err = got_error_from_errno();
+		if (errno == ENOENT)
+			err = got_error(GOT_ERR_WORKTREE_META);
+		else
+			err = got_error_from_errno();
 		goto done;
 	}
 	if (flock(fd, LOCK_SH | LOCK_NB) == -1) {
@@ -437,7 +440,7 @@ got_worktree_open(struct got_worktree **worktree, cons
 
 	do {
 		err = open_worktree(worktree, path);
-		if (err && (err->code != GOT_ERR_ERRNO && errno != ENOENT))
+		if (err && !(err->code == GOT_ERR_ERRNO && errno == ENOENT))
 			return err;
 		if (*worktree)
 			return NULL;