Commit Briefs
warn about the interaction between got patch -p and -c
suggested by stsp@
got patch: add -c flag to apply at a specified commit
it's useful for e.g. to apply old patches that weren't generated by `got diff' or git-diff(1) and so lacks the metadata needed for the 3-way merge. manpage improvements from and ok stsp@
simplify got_patch/apply_patch to call reverse_patch in one place once
Current code is overly complex; it looks if the diff *might* use diff3 merge to postpone reverse_patch until we know for sure. Instead, just reverse_patch in apply_patch once we know if merge *is* used or not.
`got patch' pledge early
ok stsp@
got patch: error if patchfile isn't a regular file
`got patch' cannot read patches from non-regular files for obvious reasons. However, it could crash in sendmsg because pledge doesn't allow to send file descriptors referring to directories. So, restrict `got patch' to operate on regular files only and fail otherwise. This still allows to read patches from symlinks since they're resolved at open(2) time and the file type check is performed after. There may be a marginal usefullness in reading patches from fifos, but the current code doesn't allow that anyway since got-read-patch needs a seekable file descriptor anyway. ok tracey@
fix off_t type mismatches
off_t is a signed type and depending on the platform, it can be "long" or "long long", so cast to long long for printf(). ok stsp
tweak cmd_info; no functional changes intended
* don't allocate unused pack_fds * drop wpath, cpath, proc, exec and sendfd pledge promises * close the worktree ok stsp@
don't undef GOT_AUTHOR in regress
unset only in the subshell so further cose is unaffected. ok stsp@
use GOT_IGNORE_GITCONFIG in regress
fixes test_rebase_no_author_info when a valid ~/.gitconfig is found. ok stsp@
read_gitconfig: fix GOT_IGNORE_GITCONFIG case
set gitconfig_remotes to NULL to avoid a double-free, and reset the global author name/email fields too. ok stsp@
tog: refactor key map -> new view initialisation
Deduplicate view initialisation boilerplate and simplify new key map view requests with dispatch routine. Includes improvements suggested by stsp. ok stsp@
fix `got patch -R' when using diff3 merge
`got patch -R' fails spectacularly when applied on a diff that contains the info of the original blob for the diff3 merge machinery since it tries to apply the reverse of the patch to the old blob. change it to run the patch (_not_ reversed) on the old blob and then swap the arguments to got_diff3_merge which gives us the correct reverse merge of the diff. while here add a test case too. reported by naddy, discussed with and 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.
fix name clash in gotwebd
Rename GOT_PACK_NUM_TEMPFILES in gotwebd, since it clashes with a name already used in lib/repository.c. ok tracey