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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: rebase suffers '?' conflicts
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 12 Apr 2023 23:43:29 +0200

Download raw body.

Thread
On Wed, Apr 12, 2023 at 11:14:49PM +0200, Christian Weisgerber wrote:
> Stefan Sperling:
> 
> > Two diffs below:
> >  update the base commit ID of unmodified files if the blob ID matches
> >  fix rebase/histedit -a leaving some files on the temporary branch
> 
> Unfortunately, something is still not right.
> 
> * The first rebase reports a merge conflict.
> * I abort the rebase.
> * I remove the cause for the conflict.
> * I rebase again => errors are reported about "unversioned" files.
> 
> Let's look at this again:
> 
> * The first rebase reports a merge conflict.
>   -- Some files were added 'A'.
> * I abort the rebase.
>   -- Those files are reverted 'R'.
> * I remove the cause for the conflict.
> * I rebase again => errors are reported about "unversioned" files.
>   -- The files from above show up as unversioned '?'.

I see. Well, this behaviour matches what reverting an added file with
the 'got revert' command will do. An added file becomes unversioned again.
Which is the right thing to do in case the user creates a new file,
adds it to version control, and then decides to run 'got revert' to
undo this addition.

However, if added files are known to have been created by a merge
operation then deleting them from disk during revert is ok.
Because rebase and histedit start out by requiring no local changes
in the work tree we can assume that any newly added files were in
fact created by merging changes (though in case of histedit -e this is
assumption is a bit dicy so I'm less sure about histedit than rebase).

Can you try this? If this works then I'll try to add regress coverage
as well before committing it.

diff /home/stsp/src/got
commit - 46108e23186237cccae84d88785fd31d692ef535
path + /home/stsp/src/got
blob - b08ea7c98c8952d224400390c47972f2e057ee4e
file + lib/worktree.c
--- lib/worktree.c
+++ lib/worktree.c
@@ -7393,7 +7393,7 @@ got_worktree_rebase_abort(struct got_worktree *worktre
 	rfa.patch_cb = NULL;
 	rfa.patch_arg = NULL;
 	rfa.repo = repo;
-	rfa.unlink_added_files = 0;
+	rfa.unlink_added_files = 1;
 	err = worktree_status(worktree, "", fileindex, repo,
 	    revert_file, &rfa, NULL, NULL, 1, 0);
 	if (err)
@@ -7755,7 +7755,7 @@ got_worktree_histedit_abort(struct got_worktree *workt
 	rfa.patch_cb = NULL;
 	rfa.patch_arg = NULL;
 	rfa.repo = repo;
-	rfa.unlink_added_files = 0;
+	rfa.unlink_added_files = 1;
 	err = worktree_status(worktree, "", fileindex, repo,
 	    revert_file, &rfa, NULL, NULL, 1, 0);
 	if (err)