"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:
Timo Myyrä <timo.myyra@bittivirhe.fi>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 30 Jan 2022 16:05:18 +0100

Download raw body.

Thread
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
> tmy@asteroid ecl $ got st .
> M  lang/ecl/Makefile
> M  lang/ecl/distinfo
> M  lang/ecl/patches/patch-src_Makefile_in
> D  lang/ecl/patches/patch-src_c_package_d
> ?  lang/ecl/patches/patch-src_cmp_cmpmain_lsp
> M  lang/ecl/patches/patch-src_compile_lsp_in
> M  lang/ecl/patches/patch-src_configure
> M  lang/ecl/pkg/PLIST
> tmy@asteroid ecl $ file patches/patch-src_c                                                                                                                                  
> patch-src_cmp_cmpmain_lsp    patch-src_compile_lsp_in     patch-src_configure          
> tmy@asteroid ecl $ file patches/patch-src_cmp_cmpmain_lsp                                                                                                                    
> patches/patch-src_cmp_cmpmain_lsp: ASCII English text
> tmy@asteroid ecl $ ls -la patches/patch-src_cmp_cmpmain_lsp 
> -rw-r--r--  1 tmy  wsrc  1024 Jan 30 15:42 patches/patch-src_cmp_cmpmain_lsp
> tmy@asteroid ecl $ got -V
> got 0.66
> tmy@asteroid ecl
> 
> Whats status the got is expecting?

'got add' expects files in unversioned status so this should be fine.
I do not understand what makes it error out in your case.

Could you apply this patch and show what it prints to stderr?

diff a47330a24a002793ebfd33553aeb80a98f940755 /home/stsp/src/got
blob - 02ace087b87f181bf1e2f38cb278ab69608602f7
file + lib/worktree.c
--- lib/worktree.c
+++ lib/worktree.c
@@ -3855,14 +3855,17 @@ schedule_addition(void *arg, unsigned char status, uns
 	struct stat sb;
 	char *ondisk_path;
 
+	fprintf(stderr, "%s initial status %d\n", relpath, status);
 	if (asprintf(&ondisk_path, "%s/%s", a->worktree->root_path,
 	    relpath) == -1)
 		return got_error_from_errno("asprintf");
 
 	ie = got_fileindex_entry_get(a->fileindex, relpath, strlen(relpath));
 	if (ie) {
+		fprintf(stderr, "%s has file index entry\n", relpath);
 		err = get_file_status(&status, &sb, ie, ondisk_path, dirfd,
 		    de_name, a->repo);
+		fprintf(stderr, "%s has status %d\n", relpath, status);
 		if (err)
 			goto done;
 		/* Re-adding an existing entry is a no-op. */