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

From:
James Cook <falsifian@falsifian.org>
Subject:
[patch] Fixes to GOT_ERR_MERGE_COMMIT_OUT_OF_DATE
To:
gameoftrees@openbsd.org
Date:
Sun, 4 Jun 2023 15:29:09 +0000

Download raw body.

Thread
Summary:

Fix GOT_ERR_MERGE_COMMIT_OUT_OF_DATE.

- Give it a value distinct from GOT_ERR_MERGE_STAGED_PATHS.
- Fail with it even if the new changes only affect unrelated paths.

--------

I ran into a situation where "got merge" silently reverted changes I'd
made. It goes like this:

- Do an interrupted merge (with got merge -n or there are conflicts).

- In another worktree, add an unrelated commit that touches a different
  file "foo".

- Complete the merge.

You will find that your changes to "foo" have been reverted in the new
commit.

This patch fixes that by not restricting
GOT_ERR_MERGE_COMMIT_OUT_OF_DATE to cases where files related to the
merge have changed. This also makes the check simpler.

Two things you might want to take a close look at:

- I changed the value of GOT_ERR_MERGE_COMMIT_OUT_OF_DATE; will that
  break anything? E.g. does it ever get serialized?

- I did not carefully read the got_worktree_merge_commit function that I
  deleted the TAILQ_FOREACH block from. E.g. I don't know if it can be
  simplified further now that the block is gone.

-- 
James