Commit Briefs

Thomas Adam

plug leak in the commit graph iterator

We fail to release the memory for the nodes. To fix it however, we some consumer of the commit graph iterator need to be corrected: the returned pointer is safe to be used only up until the next iter_next call; save a copy it if it's needed afterwards too. ok stsp@


Thomas Adam

got: fflush(stdout) after asking questions

Not everywhere getline does an implicit fflush, so we might end up not showing the prompt to the user. Spotted on alpine with muslc. ok Thomas Adams


Thomas Adam

forbid rebase of references outside the refs/heads/ namespace

ok jrick


Thomas Adam

Do not segfault verifying "lightweight" tags

ok stsp@



Thomas Adam

got: fix typo in argc check when diffing two blobs

We already have two arguments when diffing two blobs, so check for more than two like we do when diffing two objects to check for invalid path args. Includes new regress test by op for diffing two blobs. ok stsp@ and ok plus regress test from op@


Thomas Adam

fix overflow in blame callback

spotted by noticing gotwebd crashing on some blame requests. Diff from stsp@ with a fix from tracey@, I'm committing it only because he is short on time. ok stsp@


Thomas Adam

fix snprintf error handling

follow the "proper secure idiom" described in the CAVEATS section of printf(3). reminded by tb@ and millert@


Thomas Adam

Group options in accordance with style(9)

patch by Josiah Frentsos



Thomas Adam

avoid allocating too many errors in cmd_info

got_error_path uses get_custom_err to get a statically allocated error allocated on a buffer that's used a ring. This is nice and simple, but the drawback is that thees custom errors shouldn't be used "for too long" because they might get overwritten later. cmd_info is one offender: change it to store a "simple" error and later re-use it to construct the per-path error. OK and tweaks stsp@


Thomas Adam

fix "got tag" not tagging the work tree's current branch by default

found by jrick


Thomas Adam

tog: keymaps to jump to next/prev file/hunk in the diff

Add () and {} key maps to navigate to the previous and next file or hunk in the diff. This required changing Got's diff API to collect line type metadata in addition to the line offsets already produced as prompted by stsp. ok stsp@


Thomas Adam

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@


Thomas Adam

`got patch' pledge early

ok stsp@


Thomas Adam

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@


Thomas Adam

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@



Thomas Adam

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.


Thomas Adam

reset committer during rebase and histedit

ok op@



Thomas Adam

fix wrong error return in cmd_commit()


Thomas Adam

We don't care about the length of the read line.

Found by llvm's scan-build (dead store). OK stsp


Thomas Adam

Dot not ignore error from got_object_id_str().

Found by llvm's scan-build (dead store). OK stsp


Thomas Adam

typo in cat_commit

otherwise prints the author instead of the committer