Commit Briefs
when aborting rebase/histedit/merge, unlink files added by merged changes
Otherwise we leave unversioned files behind in the work tree which may interfere with new attempts to rebase or merge the changes again. Problem found by + ok naddy@
fix rebase/histedit -a leaving some files on the temporary branch
The commands 'got rebase -a' and 'got histedit -a' were checking out files from the wrong commit. Make them check files out from the commit we are switching the work tree to, as intended. Avoids spurious merge conflicts when the work tree is later used for another rebase operation. It also makes 'got update' right after 'rebase -a' a no-op, as it should be. Problem found by naddy@ while rebasing jca's llvm15 branch ok op, jamsek earlier version
regress: replace "sed -i" with ed(1) for portable in-place editing
"sed -i" is fundamentally unportable. GNU and OpenBSD sed(1) treat the extension for the backup file as an optional argument and use "sed -i" for no backup file. FreeBSD sed(1) treats the extension as an obligatory argument and uses "sed -i ''" for no backup file. There is no single syntax that works for both. ok stsp op
make 'got rebase' work when the to-be-rebased branch has no parent commit
found by and ok op@, who also provided the test case
respect umask when creating or changing files and directories
This behaviour is already documented in got-worktree(5) but wasn't actually implemented. ok stsp@
don't undef GOT_AUTHOR in regress
unset only in the subshell so further cose is unaffected. ok stsp@
do not require local author info during 'got rebase'
My commit to reset committer info during rebase was too strict in some use cases. Even when simply forwarding a branch the rebase operation could now fail if GOT_AUTHOR is not set. To fix this, fall back on existing commiter information if no author is configured. And try to obtain author info from Git config in case GOT_AUTHOR is not set. Problems reported by Mikhail.
use test(1) -eq and -ne to compare integers, and reduce quoting
This brings the rest of the regression test scripts in line with patch.sh.
switch branches during noop rebases
Always update to the specified branch even if the branch is already rebased (no commits needed to be rebased, and the branch does not need a fast forward). With the old behavior of erroring and staying on the current branch, I sometimes found myself ignoring the error message, treating it as information and assuming the branch update, and later on committing on top of origin/main instead of the main branch. feedback and ok stsp
fix unrelated changes being merged by got cherrypick/backout/rebase/histedit
This was a long-standing and very annoying bug. The two xfail tests in the cherrypick test suite are passing now.