From: Omar Polo Subject: Re: add missing rebase out-of-date check To: Stefan Sperling Cc: gameoftrees@openbsd.org Date: Sun, 08 Jan 2023 12:43:30 +0100 On 2023/01/08 11:52:35 +0100, Stefan Sperling wrote: > I found a situation where 'got rebase' will proceed even though the > work tree is out-of-date. This happens because a seqence of youngest > common-ancestor and same-branch checks will trivially succeed, leading > 'got rebase' to assume that this rebase is a fast-forward. However, > it only looks like a fast-forward because we miss the fact that the > work-tree's base commit is out of date, ignoring newer commits on the > work-tree's branch. > > This situation is not covered by the existing rebase_out_of_date test. > To reproduce the problem, run the new test added with this patch, with > the got/got.c part of this patch backed out: > > test_rebase_out_of_date2 rebase succeeded unexpectedly > test failed; leaving test data in /tmp/got-test-rebase_out_of_date2-N3qmgXLx > $ cat /tmp/got-test-rebase_out_of_date2-N3qmgXLx/stdout > refs/heads/newbranch is already based on refs/heads/master > Switching work tree from refs/heads/master to refs/heads/newbranch > U epsilon/zeta > U gamma/delta > Updated to refs/heads/newbranch: f5fd50fc48b880a976504bb432c60f1372c5dc9c > $ > > ok? ok op@