"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Unable to add new patch, "file has unexpected status"
To:
"Herbert J. Skuhra" <herbert@gojira.at>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 30 Jan 2022 19:28:54 +0100

Download raw body.

Thread
On Sun, Jan 30, 2022 at 05:08:35PM +0100, Herbert J. Skuhra wrote:
> On Sun, Jan 30, 2022 at 05:57:20PM +0200, Timo Myyrä wrote:
> > Stefan Sperling <stsp@stsp.name> [2022-01-30, 16:05 +0100]:
> > 
> > > On Sun, Jan 30, 2022 at 04:19:31PM +0200, Timo Myyrä wrote:
> > >
> > >> 
> > >> I got following error when I try to add new local patch to a port:
> > >> 
> > >> tmy@asteroid ecl $ got add  lang/ecl/patches/patch-src_cmp_cmpmain_lsp   
> > >> got: /usr/ports/lang/ecl/lang/ecl/patches/patch-src_cmp_cmpmain_lsp: file has unexpected status
> 
> 1. This patch only adds debug info.
> 2. You run different commands before and now ... the first is obviously
> wrong.

Oh, right. Now I see it too :)  Timo, you need to specify paths
relative to your current working directory.

The error message could be improved, though. How about this?

$ got add foo/bar
got: /home/stsp/src/got/foo/bar: No such file or directory
$

diff c7b1723265fdbbef35d01135261fab2ca7d52f88 /home/stsp/src/got
blob - 02ace087b87f181bf1e2f38cb278ab69608602f7
file + lib/worktree.c
--- lib/worktree.c
+++ lib/worktree.c
@@ -3874,7 +3874,10 @@ schedule_addition(void *arg, unsigned char status, uns
 	}
 
 	if (status != GOT_STATUS_UNVERSIONED) {
-		err = got_error_path(ondisk_path, GOT_ERR_FILE_STATUS);
+		if (status == GOT_STATUS_NONEXISTENT)
+			err = got_error_set_errno(ENOENT, ondisk_path);
+		else
+			err = got_error_path(ondisk_path, GOT_ERR_FILE_STATUS);
 		goto done;
 	}